Home >Backend Development >PHP Tutorial >PHP怎么输出一张图片

PHP怎么输出一张图片

WBOY
WBOYOriginal
2016-06-23 14:11:512268browse

    $t=imagecreatetruecolor(100,100);
    $red=imagecolorallocate($t,255,0,0);
    imagefill($t,0,0,$red);
    header('Content-type:image/png');
    imagepng($t);
    imagedestroy($t);
?>
人家说用这样一段代码就可以输出一张图片,可是我用这样的代码确输出下面的页面,求指导啊!!!!


回复讨论(解决方案)

都去掉,不要用include等代入上面的代码。

后面有空行?

都去掉,不要用include等代入上面的代码。 解决了,谢谢
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