PHP Implementation Verification Code production
Let's take a look at the general effect.
So the next step is to put the code directly.
Php$image= Imagecreatetruecolor (100, 30);//Create a canvas $imagecolor= Imagecolorallocate ($image, 255, 255, 255);//Background ColorImagefill ($image, 0, 0,$imagecolor);//Fill Background Color for($i= 0;$i<4;$i++ ){//Loop 4-digit $fontsize= 6; $fontcolor= Imagecolorallocate ($image,Rand(0, 200),Rand(0, 200),Rand(0, 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= 0;$i<200;$i++ ){//loop to add interference points $pointcolor= Imagecolorallocate ($image,Rand(50, 200),Rand(50, 200),Rand(50, 200)); $x=Rand(1, 99); $y=Rand(1, 29); Imagesetpixel ($image,$x,$y,$pointcolor); } for($i= 0;$i<3;$i++){//loop Add interference line $linecolor= Imagecolorallocate ($image,Rand(100, 250),Rand(100, 250),Rand(100, 250)); $x 1=Rand(1, 25); $x 2=Rand(50, 75); $y 1=Rand(1, 15); $y 2=Rand(15, 25); Imageline ($image,$x 1,$y 1,$x 2,$y 2,$linecolor); } Header("Content-type:image/png"); Imagepng ($image); Imagedestroy ($image);?>