加入干扰象素的生成验证码图片
<?php Header("Content-type: image/PNG"); srand((double)microtime()*1000000); $im = imagecreate(58,25); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); $gray = ImageColorAllocate($im, 200,200,200); imagefill($im,68,30,$gray); //将四位整数验证码绘入图片 imagestring($im, 5, 10, 8, $HTTP_GET_VARS['authnum'], $black); for($i=0;$i<200;$i++) //加入干扰象素 { imagesetpixel($im, rand()%70 , rand()%30 , $black); } ImagePNG($im); ImageDestroy($im);
永久地址:http://www.phprm.com/code/941532b10854c09a6b1976d8afc6b835.html
转载随意~请带上教程地址吧^^