2013-03-20 62 views
0

需要什麼錯誤報告組合來顯示異常但不是完整的堆棧跟蹤?如何配置php/apache2顯示異常但不是堆棧跟蹤?

即:

throw new Exception("This is an exception"); 

顯示「這是一個例外」,而不是下面的完整的跟蹤?

+0

你需要抓住它,並告訴你只想什麼'e.getMessage() ' – 2013-03-20 17:27:04

回答

0

使用set_exception_handler創建自己的異常處理程序只顯示錯誤消息

例如:

set_exception_handler(
    function($e) { 
     echo $e->getMessage(); 
     //exit(); dont have to be called 
    } 
);