程序调试的时候,提示:Notice: Undefined offset: 2048 in D:\ktdms\knowledgeTree\php\error_handler.php on line 35下面是error_handler.php 的源代码,麻烦各位高手给我看看,是什么地方出了问题<?php
$customErrorHandler = true;
$phpErrorList = array();function phpErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
$errfile = str_replace("\\", "/", $errfile);
$errorType = array (
E_ERROR           => "Erreur",
E_WARNING         => "Alerte",
E_PARSE           => "Erreur d'analyse",
E_NOTICE          => "Note",
E_CORE_ERROR      => "Core Error",
E_CORE_WARNING    => "Core Warning",
E_COMPILE_ERROR   => "Compile Error",
E_COMPILE_WARNING => "Compile Warning",
E_USER_ERROR      => "Erreur sp�cifique",
E_USER_WARNING    => "Alerte sp�cifique",
E_USER_NOTICE     => "Note sp�cifique",
); $GLOBALS["phpErrorList"][] = array ($errorType[$errno], $errstr, $errfile, $errline);
}function displayPhpError()
{
global $customErrorHandler, $phpErrorList;
if ($customErrorHandler === false)
return;
$cd = dirname(__FILE__);
$cd = str_replace("\\", "/", $cd);
$errmsg = "";
$c = count($phpErrorList);
if ($c == 0)
{
echo "<div style=\"position: absolute; top: 0px; right: 0px; font-size: 10px; font-family: Verdana, Arial, Helvetiva, Sans-Serif; border: 5px solid green; padding: 3px; background-color: lightgreen;\">";
echo "Script OK";
echo "</div>";
return;
}
$errmsg = "Erreur" . ($c > 1 ? "s" : "") . ": <span style=\"font-weight: bold;\">" . $c . "</span><br />\n";
foreach ($phpErrorList AS $error)
{
$error[2] = str_replace($cd, "", $error[2]);
if (substr($error[2], 0, 1) == "/")
$error[2] = substr($error[2], 1);
$errmsg .= "<b>" . $error[0] . "</b>: <span style=\"color: red;\">" . $error[1] . "</span> dans le fichier <span style=\"font-weight: bold;\">" . $error[2] . "</span> � la ligne <span style=\"font-weight: bold;\">" . $error[3] . "</span><br />\n";
}
echo "<div style=\"position: absolute; font-size: 10px; font-family: Verdana, Arial, Helvetiva, Sans-Serif; top: 0px; right: 0px; border: 5px solid red; padding: 3px; background-color: white;\">\n";
echo $errmsg;
echo "</div>\n";}if ($customErrorHandler)
set_error_handler("phpErrorHandler");?>

解决方案 »

  1.   

    错误提示的35行,就是这句[code=PHP  $GLOBALS["phpErrorList"][] = array ($errorType[$errno], $errstr, $errfile, $errline);
    ][/code]
      

  2.   

    错误提示的35行,就是这句  $GLOBALS["phpErrorList"][] = array ($errorType[$errno], $errstr, $errfile, $errline); 
      

  3.   

    $errno是数组啊
    $errorType[$errno]这么用不对,你的指定$errno中具体元素
      

  4.   

    给 $errorType 数组中加上
    E_STRICT => ' Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. ',