PHP generates a CAPTCHA image,
PhpHeader(' Content-type:image/png ');$image=imagecreatetruecolor (100, 30);$color=imagecolorallocate ($image, 255, 255, 255); Imagefill ($image, 20, 20,$color);
Contains only numbers//For ($i =0; $i <4; $i + +) {//$font = 6; $x =rand (5,10) + $i *100/4; $y =rand (8, 15); $string =rand (0, 9); $color =imagecolorallocate ($image, Rand (0,120), Rand (0,120), Rand (0,120)); Imagestring ($image, $font, $x, $y, $string, $color);/}
containing numbers and letters. for($i= 0;$i<4;$i++){ $fontSize=6; $x=Rand(5,10) +$i*100/4; $y=Rand(5, 15); $data= ' abcdefghijklmnopqrstuvwxyz123456789 '; $string=substr($data,Rand(0,strlen($data)), 1); $color=imagecolorallocate ($image,Rand(0,120),Rand(0,120),Rand(0,120)); Imagestring ($image,$fontSize,$x,$y,$string,$color);}
Interference point Element for($i= 0;$i<200;$i++){ $pointColor=imagecolorallocate ($image,Rand(100, 255),Rand(100, 255),Rand(100, 255)); Imagesetpixel ($image,Rand(0, 100),Rand(0, 30),$pointColor);}
Interference line Elements for($i= 0;$i<2;$i++){ $linePoint=imagecolorallocate ($image,Rand(150, 255),Rand(150, 255),Rand(150, 255)); Imageline ($image,Rand(10, 50),Rand(10, 20),Rand(80,90),Rand(15, 25),$linePoint);} Imagepng ($image); Imagedestroy ($image);?>
http://www.bkjia.com/PHPjc/1030386.html www.bkjia.com true http://www.bkjia.com/PHPjc/1030386.html techarticle PHP generates a CAPTCHA image, PHP header (' content-type:image/png '), $image =imagecreatetruecolor (+), $color =imagecoloralloc Ate ($image, 255, 255, 255) Imagefill ($imag ...