如何制作一个简单PHP验证码来应对长尾词输入错误?
- 内容介绍
- 文章标签
- 相关推荐
本文共计148个文字,预计阅读时间需要1分钟。
php
$num=;for ($i=0; $i
<?php $image=imagecreatetruecolor(100, 30); $white=imagecolorallocate($image, 255, 255, 2); $red=imagecolorallocate($image, 255, 0, 0); imagefill($image, 0, 0, $white); //munber create $num=""; for($i=0;$i<5;$i++){ $num.=rand(1,9); } imagestring($image, 6, rand(10,20), rand(00,10), $num,imagecolorallocate($image, rand(0,100), rand(100,125), rand(0,255)) ); for($j=0;$j<200;$j++){ imagesetpixel($image,rand(1,199), rand(1,29), imagecolorallocate($image, 255, 0, 0)); } for($k=0;$k<5;$k++){ imageline($image, rand(1,99), rand(1,29), rand(1,99), rand(1,29), imagecolorallocate($image,0,255, 0)); } header("Content-type:image/png"); imagepng($image); imagedestroy($image); ?>
本文共计148个文字,预计阅读时间需要1分钟。
php
$num=;for ($i=0; $i
<?php $image=imagecreatetruecolor(100, 30); $white=imagecolorallocate($image, 255, 255, 2); $red=imagecolorallocate($image, 255, 0, 0); imagefill($image, 0, 0, $white); //munber create $num=""; for($i=0;$i<5;$i++){ $num.=rand(1,9); } imagestring($image, 6, rand(10,20), rand(00,10), $num,imagecolorallocate($image, rand(0,100), rand(100,125), rand(0,255)) ); for($j=0;$j<200;$j++){ imagesetpixel($image,rand(1,199), rand(1,29), imagecolorallocate($image, 255, 0, 0)); } for($k=0;$k<5;$k++){ imageline($image, rand(1,99), rand(1,29), rand(1,99), rand(1,29), imagecolorallocate($image,0,255, 0)); } header("Content-type:image/png"); imagepng($image); imagedestroy($image); ?>

