<?phpfor ($i=0;$i<4;$i++)
{
$s.=dechex(rand(1, 15));

}
echo $s;
$im=imagecreatetruecolor(100, 30);
$bg=imagecolorallocate($im, 0, 0, 0);
$te=imagecolorallocate($im, 255, 255, 255);
imagestring($im, rand(1, 6), rand(3, 70), rand(0, 16), $s, $te);
header("Content-type: imag/jpeg");
imagejpeg($im);
?>
谁能告诉我 这个为什么是乱码

解决方案 »

  1.   

    for ($i=0;$i<4;$i++)
    {
    $s.=dechex(rand(1, 15));}
    //echo $s;
    $im=imagecreatetruecolor(100, 30);
    $bg=imagecolorallocate($im, 0, 0, 0);
    $te=imagecolorallocate($im, 255, 255, 255);
    imagestring($im, rand(1, 6), rand(3, 70), rand(0, 16), $s, $te);
    header("Content-type: image/jpeg");
    imagejpeg($im);
      

  2.   

    改过了 ,但是图片无法显示    不会是我的配置有问题吧   ;extension=php_gd2.dll
      这个我改过了啊
      

  3.   

    你的代码在我这可以显示。 你重启apache试试看。
      

  4.   

    Cannot modify header information - headers already sent by (output started at D:\usr\www\html\yzm\yzm.php:8) in <b>D:\usr\www\html\yzm\yzm.php</b> on line <b>15</b><br 这个是warning
      

  5.   

    头部已有输出。 检查是否有BOM头。还有 <?php  前面是否有空格和空行。。
      

  6.   

    将header("Content-type: image/jpeg"); 放到第一行去
      

  7.   

    $s = '';
    for ($i=0;$i<4;$i++)
    {header("Content-type: image/jpeg");这类问题很好解决只要将header注释了就能够看出来Notice: Undefined variable: s in D:\mydir\index.php on line 4
    ����JFIF��>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), d
      

  8.   

    结贴啦     不过问题问题是我自己解决的   ob_clean()后,缓冲区中的内容被清除了........
    只需要在输出签名加一个  ob_clean()  就可以正常数输出了   谢谢各位的帮助