【发布时间】:2016-12-12 06:55:54
【问题描述】:
我想打印“解析错误”、“致命错误”、“警告”而不是$exception->getCode(),我该怎么做?
function exception_handler( $exception )
{
/*
* Parse error: syntax error, unexpected 'w' (T_STRING), expecting ';' or '{' in C:\xampp\htdocs\dermaquality\aplicacion\vista\paginas\Dermaquality\proceso\indicadores.php on line 25
*/
//echo $exception->__toString();
echo "<strong>" . $exception->getCode() . ": " . $exception->getMessage() . " in " . $exception->getFile() . " on line " . $exception->getLine() . "</strong><br/>\n";
echo str_replace( '#', '<br/>#', $exception->getTraceAsString() );
}
set_exception_handler('exception_handler');
【问题讨论】:
标签: php exception error-handling exception-handling