楼主说的是什么意思.我运行你的代码,就只生成了一个4位数的图片,没有什么html呀?

解决方案 »

  1.   

    <?php
    header ("Content-type: image/png");
    $im = @imagecreate (45,18)
       or die ("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate ($im, 201,201,201);
    $text_color = imagecolorallocate ($im, 54,54,54);
    imagestring ($im,4, 6, 2, rand(1000,9999), $text_color);
    imagepng ($im);
    imagedestroy ($im);
    header ("Content-type: text/html;");
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新用户注册</title>
    </head><body>
    hello
    </body>
    </html>
    后边的hello显不出来
      

  2.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新用户注册</title>
    </head><body>
    <table width="500" border="0" cellspacing="1" cellpadding="0">
            <tr> 
              <td width="250" valign="top"><img name="pic" src="pic.php" width="250" height="300" alt=""> 
              </td>
              <td>hello</td>
            </tr>
          </table>
    </body>
    </html>
    要把生成图片的php和放置图片的html分为两个文件
    你那种写法不会运行下面的html
      

  3.   

    在页面中加入随机图片等PHP生成图片的方法1 写一段生成图片的代码(这个楼主已经完成了)
    2 将这段代码单独保存起来,起一个名字,如pic.php
    3 在别的页面中引用这个图片程序,方法同在页面里插一个图片是一样的.
    楼主再试一下:)
      

  4.   

    不要和html混在一起
    图片程序单独存为一个文件
      

  5.   

    <img src="pic.php" alt="image" />