Home >Backend Development >PHP Tutorial >图像因其自身有错无法显示
图像因其本身有错无法显示
代码如下:
<?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 />
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);