function halt($error,$level='ERROR',$type=3,$dest=NULL){
if(is_array($error)){
Log::write($error['message'],$level,$type,$dest);
}else{
Log::write($error,$level,$type,$dest);
}
$e = array();
// 开启DEBUG的操作
if(DEBUG){
if(!is_array($error)){
$trace = debug_backtrace();
$e['message'] = $error;
$e['file'] = $trace[0]['file'];
$e['line'] = $trace[0]['line'];
$e['class'] = isset($trace[0]['class']) ? $trace[0]['class'] : '';
$e['function'] = isset($trace[0]['function']) ? $trace[0]['function'] : '';
ob_start();
debug_print_backtrace();
$e['trace'] = htmlspecialchars(ob_get_clean());
}else{
$e=$error;
}
}else{
if($url = C('ERROR_URL')){
go($url);
}else{
$e['message'] = C('ERROR_MSG');
}
}
include DATA_PATH . '/静态页面路径/文件名.html';
die;
}
具体可参考 https://gitee.com/ydtd/YDTDPHP/blob/master/YDTDPHP/Lib/Function/function.php