Php generates a verification code. Are you sure you want to repost the original site? Phpsession_start (); header (content-type: imagepng); set the format of the generated image to png $ width40; width $ height25; height $ color # ffffff original site reprint, please specify here
Session_start ();
Header ("content-type: image/png"); set the format of the generated image to png.
$ Width = 40; // width
$ Height = 25; // height
$ Color = "# ffffff"; // color
$ Num = rand (,); // generates a random number of four digits
$ _ SESSION ['Ver '] = $ num; save to session for verification
$ Img = imagecreate ($ width, $ height); // use imagecreate to create an image
$ Bg1 = imagecolorallocate ($ img, rand (0,100), rand (0,250), rand (0,255); // Image Color Collection
$ Bg2 = imagecolorallocate ($ img, rand (0,205), rand (0,250), rand (0,245 ));
// Imageline ($ img, 40, 20, 40, 40, $ color );
// Imagesetpixel ($ img, 44,44, $ color );
Imagestring ($ img, 7,4, 7, $ num, $ bg2); // add a miscellaneous
Imagepng ($ img); // generates an image
Imagedestroy ($ img); // destroy
?>
This is very simple, so I will not discuss it in detail.
Why? Php session_start (); header (content-type: image/png); set the format of the generated image to png $ width = 40; // width $ height = 25; // height $ color = # ffffff...