1. Use the GD library function to generate an image and write the specified character on the image.
Imagecreatetruecolor: create a true color image
Imagecolorallocate allocates color to an image (color palette)
Imagestring draw character
Imageline draw line
Imagesetpixel
2. output image
Imagejpeg ($ img );
PHP implementation process, detailed comments in the code, not explained too much here
Verify. php
<? = ("GBK", "UTF-8", "all sentient beings, green mountains, scenic spots, and monuments are open to us "(! () |! Mb_check_encoding (, "UTF-8" ("not a string or not UTF-8" = mb_strlen (, "UTF-8" = (= 0; <; ++ [] = mb_substr (, 1, "UTF-8" = "" (= 0; <4; ++ (0, 1 0 :. = [(0,-1 1 :. = (100 ["check"] = imagecreatetruecolor (255,255,255, 30 = imagecolorallocate (, 0, 0, 0 = imagecolorallocate (, imagettftext (, 13, (2, 9), 20, 20, "MSYH. TTF ", [" check "] = (= 0; <3; ++ imageline (, 0, (0, 20), (70,100), (0, 20 ), = imagecolorallocate (, (0, 2 55), (0,255), (0,255 (= 0; <200; ++, (1,100), (1, 30), ("Content-type: image/jpeg "imagejpeg (?>
<? (@ ['Check' (["check"] = ["check" Congratulations! The verification code is entered correctly! "" Sorry, incorrect verification code "?> <Form action = "" method = "post"> </br> <input type =" text "name =" check "> </br> <input type =" submit "value =" submit "> </ br> </form>