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