Please take a look at the exceptional for loop & lt ;? Php * for ($ i0; $ I & lt; 5; $ I ++) {$ rand. dechex (rand ();} * & nbsp; $ imgimagecreatetruecolor (); & nbsp; $ bgimagecolorallocate ($ img, 0); & nbsp; $ Let's take a look at te's for loop.
/* For ($ I = 0; $ I <5; $ I ++ ){
$ Rand. = dechex (rand (1, 15 ));
}*/
$ Img = imagecreatetruecolor (80, 20 );
$ Bg = imagecolorallocate ($ img, 0, 0 );
$ Te = imagecolorallocate ($ img, 255,255,255 );
Imagestring ($ img, 5, rand (5, 40), 0, "aaa", $ te); // The first one is the font and then X Y
Imageline ($ img, rand (), $ te );
Header ("Content-type: image/jpeg ");
Imagejpeg ($ img );
?>
The above for loop was intended to be the 5-digit hexadecimal cycle.
The reason why he needs to be injected is that if he does not notice the image below, it cannot be displayed.
It's strange that I didn't use $ rand either. why not?
In imagestring, I randomly wrote a string "aaa", changed it to $ rand, and the image became small × ....
------ Solution --------------------
This problem also exists on my machine after testing.
Solution: header ("Content-type: image/jpeg"); add ob_clean () to the previous line ();