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

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

WBOY
Release: 2016-06-23 14:00:38
Original
799 people have browsed it

代码如下:

<?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);?>
Copy after login

按照网上的方法加了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);
Copy after login
Copy after login

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);
Copy after login
Copy after login

哦,是这样的

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