Home > Backend Development > PHP Tutorial > PHP图像输出乱码

PHP图像输出乱码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:01:55
Original
879 people have browsed it

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


回复讨论(解决方案)

贴个截图看看

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




按照楼上的方法加了header还是不行啊怎么办

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


加了header之后报错

去掉第一个


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


加了header之后报错
header之前不能有任务输出 echo print等输出都去掉

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

去掉第一个  之前没有内容啊,就那3行就是全部的代码了

你就单独运行我给你的代码是肯定可以的
可以了,3Q啊。那个header是啥啊,书上还没介绍过


你就单独运行我给你的代码是肯定可以的
可以了,3Q啊。那个header是啥啊,书上还没介绍过

header() 函数向客户端发送原始的 HTTP 报头。
认识到一点很重要,即必须在任何实际的输出到浏览器被发送之前调用 header() 函数
你可以百度下里面有很多设置的



你就单独运行我给你的代码是肯定可以的
可以了,3Q啊。那个header是啥啊,书上还没介绍过

header() 函数向客户端发送原始的 HTTP 报头。
认识到一点很重要,即必须在任何实际的输出到浏览器被发送之前调用 header() 函数
你可以百度下里面有很多设置的
谢谢您的热心帮助啦!

Related labels:
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