Home >Backend Development >PHP Tutorial >PHP图像乱码问题

PHP图像乱码问题

WBOY
WBOYOriginal
2016-06-23 13:43:47773browse

代码如下:

<?php$image = imagecreatetruecolor( 100, 30 );//$bgcolor = imagecolorallocate( $image, 255, 255, 255 );//imagefill( $image, 0, 0, $bgcolor );ob_clean();header( "Content-type = image/png" );imagepng( $image );//endimagedestroy( $image );?>


访问这个页面时,出现乱码:


找了很久,没有找到解决办法.求解答~


回复讨论(解决方案)

header( "Content-type = image/png" );
改为
header( "Content-type:image/png" );

$image = imagecreatetruecolor( 100, 30 );//$bgcolor = imagecolorallocate( $image, 255, 255, 255 );//imagefill( $image, 0, 0, $bgcolor ); ob_clean();header( "Content-type:image/png" );imagepng( $image );    //endimagedestroy( $image );

= =我逗了.谢谢~

= =我逗了.谢谢~

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