getMessage(); $code = $exception->getCode(); $file = $exception->getFile(); $line = $exception->getLine(); $trace = $exception->getTrace(); $trace_message = $exception->getTraceAsString(); // \Sentry\captureException($exception); $trace_message = null; $root_path = realpath(ROOT_DIR); $output = ob_end_clean(); $position = str_replace($root_path,'>  ',$file).':'.$line; // 不报具体错误 $trace = []; $position = ''; $i=0; foreach($trace as $t){ if(!($t['class']=='kernel' && $t['function']=='exception_error_handler')){ $t['file'] = str_replace($root_path,'ROOT:',$t['file']); $basename = basename($t['file']); if($i==0){ $trace_message .= ''; }else{ $trace_message .= ''; } if($t['args']){ if($t['class'] == 'base_db_connections' && $t['function'] == '_connect') { $args_info = ''; } else { $args_info = json_encode($t['args'], JSON_UNESCAPED_UNICODE); $args_info = str_replace(['<', '>'],['<\'', '\'>'],$args_info); } if(trim($args_info)){ $args = "...$args_info"; }else{ $args = "\"$args_inf\""; } }else{ $args = ''; } if($t['line']){ $trace_message .= "#{$i}{$t['class']}{$t['type']}{$t['function']}({$args}){$basename}:{$t['line']}"; }else{ $trace_message .= "#{$i}{$t['class']}{$t['type']}{$t['function']}({$args}){$basename}"; } $i++; } } $output=<<$message

$position
$trace_message
EOF; self::output($output, 'Track'); } static function system_is_offline(){ self::output('','System is offline'); } static protected function output($body,$title='',$status_code=500){ //header('Connection:close',1,500); $date = date(DATE_RFC822); $html =<< Error: $title

$body
HTML; echo str_pad($html,1024); exit; } }//End Class