脚本宝典收集整理的这篇文章主要介绍了php生成图片验证码,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
先给看下 大致的效果
那么接下来的就直接贴代码吧
<PRe class="brush:PHP;"> <>PHP $image = imagecreatetruecolor(100,30); //创建画布 $imagecolor = imagecolorallocate($image,255,255); //背景色 imagefill($image,$imagecolor); //填充背景色 for($i=0;$i<4;$i++ ){="" 循环4位数="" $fontsize="6;" $fontcolor="imagecolorallocate($image,rand(0,200),200));" $fontcontent="rand(0,9);" $x="$i*100/4" +="" rand(5,15);="" $y="rand(5,10);" imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);="" }="" for($i="">4;$i++><200;$i++ ){="" 循环="">200;$i++>添加干扰点 $pointcolor = imagecolorallocate($image,rand(50,200)); $x = rand(1,99); $y = rand(1,29); imagesetpixel($image,$pointcolor); } for($i=0;$i<3;$i++){ 循环="" 添加干扰线="" $linecolor="imagecolorallocate($image,rand(100,250),250));" $x1="rand(1,25);" $x2="rand(50,75);" $y1="rand(1,15);" $y2="rand(15,25);" imageline($image,$x1,$y1,$x2,$y2,$linecolor);="" }="" header("content-type:image/png");="" imagepng($image);="" imagedestroy($image);="">3;$i++){>以上是脚本宝典为你收集整理的php生成图片验证码全部内容,希望文章能够帮你解决php生成图片验证码所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。