php-执行header('Content-type:image/png');之后,浏览器总是输出源代码


<!DOCTYPE html>
<html>
    <head>
        <title>test</title>
        <meta http-equiv="Content-type" content="text/html">
    </head>
    <body>
        hello
        <?php
            $image=imagecreatetruecolor(100,100);
            $red=imagecolorallocate($image,0xff,0x00,0x00);
            imagefill($image,0,0,$red);
            header('Content-type:image/png');
            imagepng($image);
            imagedestroy($image);
        ?>
    </body>
</html>

问题出在Content-type:image/png

用window的记事本编辑,源代码文件的编码utf8会有bom头、是不是这样,还需要验证、

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM