我在使用GD-PHP生成Rectangle時遇到了問題。我在Netbeans IDE上運行XAMPP和編程。我是PHP的新手,但有些與Perl相似。PHP圖形編碼錯誤
<?php
header ("Content-type: image/png");
$newImg = ImageCreate(250,250);
$red = ImageColorAllocate($newImg,255,0,0);
ImageFill($newImg,0,0,$red);
ImagePNG($newImg);
ImageDestroy($newImg);
?>
這是輸出。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
‰PNG
IHDRúú²"È~PLTEˆÁÿ·¿~`IDAThíÁ‚ ÿ¯[email protected]¿ :F¨z’IEND®B`‚ </body>
</html>