修改 PHP.INI, 将 error_reporting 设置为 error_reporting = E_ALL ~ E_NOTICE
重启 APACHE 服务

解决方案 »

  1.   

    以下是index.php的源代码:
    <?
    #-----------------------------------------------------------#
    # Project Name: RCguestbook  
    # Copyright (c) Redcolt Studio Write By Zhouchaoyuan Redcolt
    # Url:http://PCMagic.51.net
    # QICQ: 56964883
    # Authors:zcy
    # usage: guestbook.php
    #-----------------------------------------------------------#
    require "config.php";
    if(empty($home))$home=$admin[home];
    $pass=$admin[password];
    if(empty($email))$email=$admin[email];
    function oicq($uin){
     if($uin=="")return 1;else
     if(strlen($uin)<=8 and !eregi("([^0-9])",$uin))return 1;else return 0;
    }
    function getline($file){
      $data=Chop(fgets($file,5000));
      return $data;
    }
    function nowtime(){
      $date=date("Y年m月d日.G:i:s");
      return $date;
    }
    function getid(){
      $date=date("YmdGis");
      return $date;
    }
    function ubb($Text) {
      $Text=htmlspecialchars($Text);
      $Text=ereg_replace("\r\n","<br>",$Text);
      $Text=ereg_replace("\r","<br>",$Text);
      $Text=nl2br($Text);
      $Text=preg_replace("/\\t/is","  ",$Text);
      $Text=preg_replace("/\[h1\](.+?)\[\/h1\]/is","<h1>\\1</h1>",$Text);
      $Text=preg_replace("/\[h2\](.+?)\[\/h2\]/is","<h2>\\1</h2>",$Text);
      $Text=preg_replace("/\[h3\](.+?)\[\/h3\]/is","<h3>\\1</h3>",$Text);
      $Text=preg_replace("/\[h4\](.+?)\[\/h4\]/is","<h4>\\1</h4>",$Text);
      $Text=preg_replace("/\[h5\](.+?)\[\/h5\]/is","<h5>\\1</h5>",$Text);
      $Text=preg_replace("/\[h6\](.+?)\[\/h6\]/is","<h6>\\1</h6>",$Text);
      $Text=preg_replace("/\[url\](http:\/\/.+?)\[\/url\]/is","<a href=\\1>\\1</a>",$Text);
      $Text=preg_replace("/\[url\](.+?)\[\/url\]/is","<a href=\"http://\\1\">http://\\1</a>",$Text);
      $Text=preg_replace("/\[url=(http:\/\/.+?)\](.*)\[\/url\]/is","<a href=\\1>\\2</a>",$Text);
      $Text=preg_replace("/\[url=(.+?)\](.*)\[\/url\]/is","<a href=http://\\1>\\2</a>",$Text);
      $Text=preg_replace("/\[img\](.+?)\[\/img\]/is","<img src=\\1>",$Text);
      $Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","<font color=\\1>\\2</font>",$Text);
      $Text=preg_replace("/\[size=(.+?)\](.+?)\[\/size\]/is","<font size=\\1>\\2</font>",$Text);
      $Text=preg_replace("/\[sup\](.+?)\[\/sup\]/is","<sup>\\1</sup>",$Text);
      $Text=preg_replace("/\[sub\](.+?)\[\/sub\]/is","<sub>\\1</sub>",$Text);
      $Text=preg_replace("/\[pre\](.+?)\[\/pre\]/is","<pre>\\1</pre>",$Text);
      $Text=preg_replace("/\[email\](.+?)\[\/email\]/is","<a href=mailto:\\1>\\1</a>",$Text);
      $Text=preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$Text);
      $Text=preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$Text);
      $Text=preg_replace("/\[quote\](.+?)\[\/quote\]/is","<blockquote><font size='1' face='Courier New'>quote:</font><hr>\\1<hr></blockquote>", $Text);
      $Text=preg_replace("/\[code\](.+?)\[\/code\]/is","<blockquote><font size='1' face='Times New Roman'>code:</font><hr color='lightblue'><i>\\1</i><hr color='lightblue'></blockquote>", $Text);
      $Text=preg_replace("/\[sig\](.+?)\[\/sig\]/is","<div style='text-align: left; color: darkgreen; margin-left: 5%'><br><br>--------------------------<br>\\1<br>--------------------------</div>", $Text);
    return $Text;
    }
    function str($msg){
      global $admin;
      if(!$admin[html]) $msg=htmlspecialchars($msg);
      if($admin[ubb]) $msg=ubb($msg);
      $msg=nl2br($msg); #处理message
      $msg= str_replace("\n","",$msg); #处理message
      $msg= str_replace("\r","",$msg); #处理message
      return $msg;
    }
    function error($msg){
    global $admin;
    echo "<HTML><HEAD>
    <meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
    <meta name='keywords' content='php,linux,apache,mysql,技巧,php,asp'>
    <meta name='description' content='php,linux,apache,mysql,技巧,php,asp'>
    <title>电脑技巧--留言簿</title>
    <link rel='stylesheet' href='style.css'>
    <script language='JavaScript1.2'>
    window.status=' 电脑技巧--留言簿 ';
    </script>
    <body>
    <div align='center'>
      <center>
      <table border='0' width='600' height='100%' cellspacing='0' cellpadding='0'>
        <tr>
          <td width='100%' align='center'><table border='0' width='400' cellspacing='0' cellpadding='0' bgcolor='#666666'>
        <tr>
          <td width='100%'>
            <table border='0' width='100%' cellspacing='1' cellpadding='0'>
              <tr>
                <td width='100%' align='center' height='30' bgcolor='$admin[bgcolor2]'><font size='4' color='#666666'><b>发生错误</b></font></td>
              </tr>
              <tr>
                <td width='100%' align='center' bgcolor='$admin[bgcolor1]' height='120'>出错原因:<font color='#FF0000'>$msg</font>
                  <p><a href='javascript:history.go(-1);'>请点这里返回上一页检查你的输入是否有误</a>
                  <p>[ <a href='javascript:history.go(-1);'>返回上一页</a> ]</td>
              </tr>
            </table>
          </td>
        </tr>
      </table></td></tr></table></center></div></body></html>";
    }function checkmail($add){
    if(ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+",$add)) $ttt=true;
          else $ttt=false;
    return $ttt;
    }
    function pagetop(){
    global $admin;
    global $up;
    ?>
    <HTML>
    <HEAD>
    <meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
    <meta name='keywords' content='php,linux,apache,mysql,技巧,php,asp'>
    <meta name='description' content='php,linux,apache,mysql,技巧,php,asp'>
    <title><?=$admin[homename];?>--留言簿</title>
    <link rel='stylesheet' href='style.css'>
    <script language='JavaScript1.2'>
    window.status=' F60 在线--留言簿 ';
    </script>
    </head>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div align='center'> 
      <? include ('../templates/header.htm') ?>
    </div>
    <?
    }
    代码太长,我贴了开头部分
      

  2.   

    $admin[bgcolor1]
    把这类的改成
    $admin['bgcolor1']
      

  3.   

    改好以后重起一下apache!
    当然最好重起一下你的电脑!
      

  4.   

    回复人: alexzhang00(.NET闭关中...) ( ) 信誉:100  2004-10-04 23:32:00  得分: 0  
     
     
       修改 PHP.INI, 将 error_reporting 设置为 error_reporting = E_ALL ~ E_NOTICE
    重启 APACHE 服务
      
     对,这样修改一下。
    冲浪那样说,会累坏人家的,呵呵。不用改那个也行的。主要是它那个error report的设定。不要notice吧。
    楼主,notice不是错误。不要紧的。但是你要修改修改,让它不报告警告。或者在php文件开头加上也行。
      

  5.   

    最好改。
    因为如果以后有可能定义到跟索引一样的常量如果不想改。。也不一定要改php.ini只要在开头加一句
    error_reporting(E_ALL ^ E_NOTICE);
    就可以了
      

  6.   

    谢谢上面的几位大侠的指点,我在config.php的开头加了句error_reporting(E_ALL ^ E_NOTICE);
    后,大部分的报错没了,但页面上还是显示有句报错的,烦请各位大侠再看看
    Warning: fopen(..guestbook/data/main.dat): failed to open stream: No such file or directory in d:\usr\www\html\guestbook\index.php on line 695Warning: fgets(): supplied argument is not a valid stream resource in d:\usr\www\html\guestbook\index.php on line 696Warning: fgets(): supplied argument is not a valid stream resource in d:\usr\www\html\guestbook\index.php on line 20Warning: fgets(): supplied argument is not a valid stream resource in d:\usr\www\html\guestbook\index.php on line 20Warning: fgets(): supplied argument is not a valid stream resource in d:\usr\www\html\guestbook\index.php on line 20Warning: fopen(..guestbook/data/main.dat): failed to open stream: No such file or directory in d:\usr\www\html\guestbook\index.php on line 147Warning: fgets(): supplied argument is not a valid stream resource in d:\usr\www\html\guestbook\index.php on line 148
      

  7.   

    r you sure the files is ok??
    ..guestbook/data/main.dat
      

  8.   

    这个文件不存在?..guestbook/data/main.dat或者是路径错误了?
      

  9.   

    文件也是在的,在data目录下确实有个main.dat文件,不知道哪里出了原因
    真晕了
    算了
    先结帖了