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

PHP图像乱码问题

WBOY
Release: 2016-06-23 13:43:47
Original
772 people have browsed it

代码如下:

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


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


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


回复讨论(解决方案)

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 );
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