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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:51:35
Original
871 people have browsed it

图像因其本身有错无法显示
代码如下:

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

按照网上的方法加了ob_clean();
也将文档格式变为了utf-不带bom格式的
怎么还是出错呢?
------解决方案--------------------
ob_clean();<br />header("Content-type:image/png");<br />$im = @imagecreate(200, 100);<br />@imagecolorallocate($im, 240, 150, 255);<br />$color1 = imagecolorallocate($im, 0, 0, 0);<br />imagestring($im, 5, 8, 10, "I like PHP", $color1);<br />imagepng ( $im);//少了生成图片这个语句<br />imagedestroy($im);
Copy after login

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