Home >Backend Development >PHP Tutorial >php imagecreatetruecolorsheng生成图片无法正常显示,该如何处理

php imagecreatetruecolorsheng生成图片无法正常显示,该如何处理

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:22:031579browse

php imagecreatetruecolorsheng生成图片无法正常显示

<?php<br />    $t=imagecreatetruecolor(100,100);<br />    $red=imagecolorallocate($t,255,0,0);<br />    imagefill($t,0,0,$red);<br />    header('Content-type:image/png');<br />    imagepng($t);<br />    imagedestroy($t);<br />?>




------解决思路----------------------
我这边很正常,把header('Content-type:image/png'); 先去掉看看有什么错误输出。
是否有安装gd?


------解决思路----------------------
注释掉header('Content-type:image/png');  就乱码了
这表示你的图片流中含有其他数据(你可截个图贴出来看看)
可能是有 BOM 头

Statement:
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