1, generating random numbers
A For loop is used to determine how many random numbers are generated. Random numbers are generated in the range of random functions. For example, Rand (1,15), generates a number from 1 to 15. Use a 16-bit feed function to create a digital alphabet. Dechex (rand (1,15)). Use the. = operation to hold several numbers. Put the generated random number into the $_session[variable]. And so on in the future with the user submitted content comparison.
2, create a picture
Use the picture creation function to determine the size of the picture you created.
For example $im = Imagecreatetruecolor (100,30), where the coordinate 100,30 is the origin of the upper-left corner of the page, $im as a picture variable.
3, set the color
Use functions to create a background color. For example $BG = Imagecolorallocate ($im, 0,0,0), where 0,0,0 is a three-color number, $im for the picture created above. Use a function to create a font color. For example $te = Imagecolorallocate ($im, 255,255,255);
4, write the character in the upper-left corner of the image
Use the function imagestring () to write the character in the image. For example imagestring ($im, 5,0,0, $rand, $te); $im for the picture created above, 5 is the display mode, 0,0 is the coordinates, $te is the font color
5, Output image
Use the function header ("Content-type:image/jpeg"), imagejpeg ($im), and output the image.