我想显示一个自定义错误视图,而不是生产环境的默认错误页面。我的变化不大exception.php
。
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();
}
//REMOVE IF ISSUE IN APLHA3
if($_SERVER['HTTP_HOST'] != 'localhost'){
ini_set('sendmail_from','info@penpencileraser.com');
$error_message='Location: '.$filepath;
$error_message.="\n\n Message: ".$message.' \n\n Line Number :'.$line;
$error_message.="\n\n Path: ".$_SERVER['PHP_SELF'];
mail('ramya.p@abc.com','PenPencilEraser Error',$error_message);
if(APPFOLDER=='frontend'){
header("location: ".LINKURL.'errors/common');
exit;
}
}
//ob_start();
//include(APPPATH.'errors/error_php'.EXT);
//$buffer = ob_get_contents();
//ob_end_clean();
//echo $buffer;
}
我得到错误
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.