【发布时间】:2013-03-20 17:26:05
【问题描述】:
显示异常但不显示完整堆栈跟踪需要什么错误报告组合?
即:
throw new Exception("This is an exception");
显示“这是一个例外”,但不显示后面的完整跟踪?
【问题讨论】:
-
你需要抓住它并只显示你想要的
e.getMessage()
标签: php exception configuration apache2
显示异常但不显示完整堆栈跟踪需要什么错误报告组合?
即:
throw new Exception("This is an exception");
显示“这是一个例外”,但不显示后面的完整跟踪?
【问题讨论】:
e.getMessage()
标签: php exception configuration apache2
使用set_exception_handler 创建您自己的异常处理程序,它只显示错误消息
例如:
set_exception_handler(
function($e) {
echo $e->getMessage();
//exit(); dont have to be called
}
);
【讨论】: