PHP图像输出乱码,该如何解决

WBOY
Release: 2016-06-13 11:48:49
Original
905 people have browsed it

PHP图像输出乱码
刚开始学PHP,这个代码为何输出乱码
   $im = imagecreate(200,60);
   $white = imagecolorallocate($im, 225, 66, 159);
   imagegif($im);
?>


------解决方案--------------------
贴个截图看看
------解决方案--------------------

$im = imagecreate(200,60);<br />$white = imagecolorallocate($im, 225, 66, 159);<br />   // 输出图像到浏览器<br />header ( 'Content-Type: image/gif' );<br />imagegif($im);
Copy after login

------解决方案--------------------
去掉第一个 ------解决方案--------------------

引用:
Quote: 引用:

你就单独运行我给你的代码是肯定可以的

可以了,3Q啊。那个header是啥啊,书上还没介绍过


header() 函数向客户端发送原始的 HTTP 报头。
认识到一点很重要,即必须在任何实际的输出到浏览器被发送之前调用 header() 函数
你可以百度下里面有很多设置的
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template