Home  >  Article  >  Backend Development  >  图像因其本身有错无法显示

图像因其本身有错无法显示

WBOY
WBOYOriginal
2016-06-23 14:00:38767browse

代码如下:

<?php ob_clean();header("Content-type:image/png");$im = @imagecreate(200, 100);@imagecolorallocate($im, 240, 150, 255);$color1 = imagecolorallocate($im, 0, 0, 0);imagestring($im, 5, 8, 10, "I like PHP", $color1);imagedestroy($im);?>

按照网上的方法加了ob_clean();
也将文档格式变为了utf-不带bom格式的
怎么还是出错呢?


回复讨论(解决方案)

ob_clean();header("Content-type:image/png");$im = @imagecreate(200, 100);@imagecolorallocate($im, 240, 150, 255);$color1 = imagecolorallocate($im, 0, 0, 0);imagestring($im, 5, 8, 10, "I like PHP", $color1);imagepng ( $im);//少了生成图片这个语句imagedestroy($im);

ob_clean();header("Content-type:image/png");$im = @imagecreate(200, 100);@imagecolorallocate($im, 240, 150, 255);$color1 = imagecolorallocate($im, 0, 0, 0);imagestring($im, 5, 8, 10, "I like PHP", $color1);imagepng ( $im);//少了生成图片这个语句imagedestroy($im);

哦,是这样的

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