把html语句去掉。改成这样:
<?php
header ("Content-type: image/png");
$im = @imagecreate (50, 100)
or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng ($im);
imagedestroy ($im);
?>

解决方案 »

  1.   

    我把他存为draw.html,仍是什么也看不到
    <?php
    header ("Content-type: image/png");
    $im = @imagecreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate ($im, 255, 255, 255);
    $text_color = imagecolorallocate ($im, 233, 14, 91);
    imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color);
    imagepng ($im);
    imagedestroy ($im);
    ?>
      

  2.   

    gd
    GD Support enabled 
    GD Version 1.6.2 or higher 
    FreeType Support enabled 
    FreeType Linkage with TTF library 
    JPG Support enabled 
    PNG Support enabled 
    WBMP Support enabled 
    我的gd扩展库应该是没问题,但是还是看不见
    draw.php
    <?php
    header ("Content-type: image/png");
    $im = @imagecreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate ($im, 255, 255, 255);
    $text_color = imagecolorallocate ($im, 233, 14, 91);
    imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color);
    imagepng ($im);
    imagedestroy ($im);
    ?>draw.html
    <html>
    <head>
    </head>
    <body>
    <?php 
    echo "<img src='draw.php' > " 
    ?>
    </body> 
    </html>
      

  3.   

    直接运行draw.php,显示以下错误:
    Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\myphp\draw.php:1) in c:\apache\htdocs\myphp\draw.php on line 2
    ?PNG  IHDR2d?PLTE?[?&#733;?<IDATx?c` 03<b?,?@ ?&#1650;[&#1563;??l&#636162;[?&#271;?&#348213;0?j&#488;?&#53834;;?&#1557;瀀IEND?B`?
    到底怎么回事?!
      

  4.   

    问题我自己解决了,谢谢各位!换了php的版本和apache就可以了。