We have talked a lot about how php generates a graphic Verification Code. This is a very simple tutorial for php beginners. It is an example code that uses php to generate a verification code.
We have talked a lot about how to generate a graphic verification code in the php tutorial, which is very simple and suitablePhp entryIs an example code that uses php to generate a verification code.
<? Php
$ Height = 300;
$ Width = 300;
// Create a background image
$ Im = ImageCreateTrueColor ($ width, $ height );
// Assign color
$ White = ImageColorAllocate ($ im, 255,255,255 );
$ Blue = ImageColorAllocate ($ im, 0, 0, 64 );
// Draw the color to the image
ImageFill ($ im, 0, 0, $ blue );
// Draw the string: Hello, PHP
ImageString ($ im, 10,100,120, 'Hello, php', $ white );
// Output the image and define the header
Header ('content-type: image/png ');
// Send the image to the browser
ImagePng ($ im );
// Clear Resources
ImageDestroy ($ im );
?>