<?php
session_start();
error_reporting(E_ALL & ~E_NOTICE);
$chars = "123456789ABCDEFGHIJKLMNPQRSTUVWXYZ";
$string = "";
for ($i = 0; $i < 5; $i++)
{
  srand((double)microtime() * 1000000);
    //srand()设置随机数种子,microtime获取当前时间的百万分之一
  $rand = rand(0, strlen($chars) - 1);
  $string.= substr($chars, $rand, 1); //截取字符串,只截取一个
}
session_unregister("string"); //注销上一次使用的字符串
session_register("string");
$_SESSION['code'] = $string;
header("Content-type: image/jpeg"); //输出图形格式
$imagewidth = 120;
$imageheight = 30;
$im = imagecreate($imagewidth, $imageheight); //创建一个图像流
$backcolor = imagecolorallocate($im, rand(220, 225), rand(220, 225), rand(220,
  225)); //设置背景色
imagefilledrectangle($im, 0, 0, $imagewidth, $imageheight, $backcolor);
  //填充一个长方形,坐标位于(0,0)
for ($i = 0; $i < 200; $i++)
{
  $dotcolor = imagecolorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255))
    ; //配置点的颜色
  $x = rand(0, $imagewidth);
  $y = rand(0, $imageheight); //产生随机坐标
  imagesetpixel($im, $x, $y, $dotcolor); //填充点
}for ($i = 0; $i < strlen($string); $i++)
{
  $frontcolor = imagecolorallocate($im, rand(0, 120), rand(0, 120), rand(0, 120)
    );
  imagestring($im, 10, rand(20 * $i + 1, 20 * $i + 10), rand(0, 5), substr
    ($string, $i, 1), $frontcolor); //填充字符串,字体10号,坐标随机substr() 函数返回字符串的一部分。
//substr(string,start,length)
}imagejpeg($im); //输出这个图形
imagedestroy($im); //销毁临时资源
exit();
?>
这段代码在我机子上能正常显示,到其他机子上确是乱码或者叫我下载为什么呢!请高手解答!