PHP image output garbled code. Why does this code output garbled code ;? Php & nbsp; $ im & nbsp; = & nbsp; imagecreate (); & nbsp; $ white & nbsp; = & nbsp; imagecolorallo PHP image output garbled
Why does this code output garbled characters when I first started learning PHP?
$ Im = imagecreate (200,60 );
$ White = imagecolorallocate ($ im, 225, 66,159 );
Imagegif ($ im );
?>
------ Solution --------------------
Paste it
------ Solution --------------------
$ Im = imagecreate (200,60 );
$ White = imagecolorallocate ($ im, 225, 66,159 );
// Output the image to the browser
Header ('content-Type: image/gif ');
Imagegif ($ im );
------ Solution --------------------
Remove the first ------ Solution --------------------
Reference:
Quote: reference:
You can run the code I gave you separately.
Yes, 3Q. What is the header? it hasn't been introduced in the book.
The header () function sends the original HTTP header to the client.
It is important to realize that the header () function must be called before any actual output is sent to the browser.
You can have many settings in Baidu.