本帖最后由 u010880676 于 2013-05-29 15:16:40 编辑

解决方案 »

  1.   

    在IE6里面显示正常,表示代码是正确的
    你可执行下面的代码,并贴出结果
    print_r(get_headers('你程序的URL'));
      

  2.   

    单独写个php文件,里面写上:<?php phpinfo();   ie8 里面看是否显示php信息。
      

  3.   


    Array ( [0] => HTTP/1.1 200 OK [1] => Connection: close [2] => Date: Wed, 29 May 2013 08:34:44 GMT [3] => Server: Microsoft-IIS/6.0 [4] => X-Powered-By: ASP.NET [5] => X-Powered-By: PHP/5.2.9-2 [6] => Set-Cookie: PHPSESSID=0itnjvublnkmcjnmolumfr7tv6; path=/ [7] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [8] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [9] => Pragma: no-cache [10] => Content-Type:image/png ) 
      

  4.   

    Array (
     [0] => HTTP/1.1 200 OK
     [1] => Connection: close
     [2] => Date: Wed, 29 May 2013 08:34:44 GMT
     [3] => Server: Microsoft-IIS/6.0
     [4] => X-Powered-By: ASP.NET
     [5] => X-Powered-By: PHP/5.2.9-2
     [6] => Set-Cookie: PHPSESSID=0itnjvublnkmcjnmolumfr7tv6; path=/
     [7] => Expires: Thu, 19 Nov 1981 08:52:00 GMT
     [8] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
     [9] => Pragma: no-cache
     [10] => Content-Type:image/png 弄错了吧?怎么有这个?
     ) 
      

  5.   

    <?php
    /**
    * 生成验证码的类
    *
    */
    class code{
    var $str;     //随机生成的字符串
    var $width = 85;   //验证码图片的宽度
    var $height = 20;  //验证码图片的高度
    /**
      * 构造函数
      *
      * @param String $width    验证码图片的宽度
      * @param String $height   验证码图片的高度
      * @param String $size     字符个数
      */
    function code($width = 50,$height = 25,$size = 4){
      $this->str = $this->random($size);
      $this->width = $width;
      $this->height = $height;
      //session_register("code");
      $_SESSION["code"] = $this->str;
    }
    /**
      * 随即生成字符的函数
      *
      * @param int $len    要生成的字符的个数
      * @return 生成的字符串
      */
    function random($len){ 
      $srcstr="abcdefghijklmnopqrstuvwxyz0123456789"; 
      mt_srand(); 
      $strs=""; 
      for($i=0;$i<$len;$i++){ 
       $strs.=$srcstr[mt_rand(0,35)]; 
      } 
      return $strs; 
    } /**
      * 生成验证码并输出
      *
      */#7CD3E7
    function genimg(){ 
         @header("Content-Type:image/png"); 
      $im=imagecreate($this->width,$this->height); 
      
      //背景色 
      $back=imagecolorallocate($im,0xFF,0xFF,0xFF); 
      //模糊点颜色 
      $pix=imagecolorallocate($im,187,230,247); 
      //字体色 
      $font=imagecolorallocate($im,41,163,238); 
      
      //绘模糊作用的点 
      mt_srand(); 
      for($i=0;$i<1000;$i++){ 
       imagesetpixel($im,mt_rand(0,$this->width),mt_rand(0,$this->height),$pix); 
      } 
      
      
      //写字,选择ComicSansMS字体 
      //imagettftext($im,20,0,3,25,$font,"comic.ttf",$this->str);
      //$x = mt_rand(1,20);
      //$y = mt_rand(0,18); 
      imagestring($im, 8, 10, 5,$this->str, $font);
      imagerectangle($im,0,0,$this->width-1,$this->height-1,$font); 
      
      
      imagepng($im,"imcode.png"); 
      imagedestroy($im);

    }
    ?>

    是调用这里面的文件有问题?
      

  6.   


    嗯 是啊IE8显示源码,你前面说这个有问题/ [9] => Pragma: no-cache  [10] => Content-Type:image/png 弄错了吧?怎么有这个?  ) 
      

  7.   


    嗯 是啊IE8显示源码,你前面说这个有问题/ [9] => Pragma: no-cache  [10] => Content-Type:image/png 弄错了吧?怎么有这个?  ) <?php 
    if(empty($_POST['action'])){
    include 'include/code.php';
    $s = new code();
    $s->genimg();
    ?>

    <?php 
    }
    else{
    ?>
    <table width="750" border="0" align="center" cellpadding="0" cellspacing="10">
      <tr> 
        <td><table width="97%" border="0" align="center" cellpadding="0" cellspacing="15">
            <tr> 
              <td align="center"><table width="100%" border="0" cellpadding="6" cellspacing="0" class="border2">
                  <tr>
                    <td align="center">
        <?php
     $unum_temp=$_POST['verifycode'];
     if($unum_temp==$_SESSION["code"])
        {
      $admin_user=trim($_POST['userr']);
                  $admin_pass=md5(trim($_POST['pwd']));
         $rs = $db->query("select * from yzlove_admin where username='".$admin_user."' and password='".$admin_pass."'");
      //echo $admin_pass ;
      //echo exit;
    if(!$db->num_rows($rs)){
    echo "<script language=\"javascript\">alert('帐号输入不正确或者密码不正确!');history.go(-1)</script>";
                    } 
    else {
        $row = $db->fetch_array($rs);
                            //增加session
    $_SESSION['adminpass']=trim($admin_pass);
    $_SESSION['adminname']=trim($admin_user);
    $_SESSION['id']=$row[0];
    // echo $id;
    // exit;
    $ips=GetIP();
    $datetime= date("Y-m-d H:i:s");
    $db->query("update yzlove_admin set endip='".$ips."',endtime='".$datetime."',logincount=logincount+1 where id=".$row[0]);
    // echo $_SESSION['flag'];
    // exit;
    echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\">";

    }
    }else{
    echo "<script language=\"javascript\">alert('对不起,验证码不正确,请重新输入……');history.go(-1)</script>";
    }
    ?>
                 </td>
              </tr>
                </table></td>
            </tr>
          </table></td>
      </tr>
    </table>
       <?php }?>
        
    这两段删掉就正常显示了,是验证码的问题吧,能帮我看看什么问题?