|
用CI的时候,如果一个变量没有值,CI就会提示 Undefined,用PHP的开发的人都知道,定义PHP的变量是不需要初始化任何的值,看这notice真烦人,决定关掉它,开始先搜 A PHP Error was encountered 只在error目录中找到error_php.php,不是想要的结果,这文件只是模板,再搜文件名:error_php,在system/libraies中的Exceptions中发现
/**
* Native PHP error handler
*
* @access private
* @param string the error severity
* @param string the error string
* @param string the error filepath
* @param string the error line number
* @return string
*/
function show_php_error($severity, $message, $filepath, $line)
{
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
$filepath = str_replace("\\", "/", $filepath);
// For safety reasons we do not show the full file path
if (FALSE !== strpos($filepath, '/'))
{
$x = explode('/', $filepath);
$filepath = $x[count($x)-2].'/'.end($x);
}
if (ob_get_level() > $this->ob_level + 1)
{
ob_end_flush();
}
ob_start();
include(APPPATH.'errors/error_php'.EXT);
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
}
找到include(APPPATH.'errors/error_php'.EXT); 这行,把它注释掉,就OK了
本文来自黄俊 |
|