时间:2021-07-01 10:21:17 帮助过:14人阅读
$red1,'1'=>$green1,'2'=>$blue1 );
//填充画布背景色
imagefill($img, 0, 0, $bgcolor);
//添加验证码内容
for($i=0;$i<4;$i++)
{
$content .='';
$c
}
imagestring($img, 40, 20, 10, $content,$col[rand(0,2)] );
//添加干扰因素
//添加干扰点
for($i=0;$i<50;$i++)
{
imagesetpixel($img, rand(0,80), rand(0,40), $col[rand(0,2)]);
}
//添加干扰线
for($j=0;$j<4;$j++)
{ //imageline函数的格式:imageline(image, x1, y1, x2, y2, color); imageline($img, rand(0,20), rand(0,20), rand(0,80), rand(0,30), $col[rand(0,2)]); } //输出图像 imagepng($img); //释放图像资源 imagedestroy($img); ?>
以上就介绍了学习php最简单的验证码制作,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。