我有一個很奇怪的情況:下面顯示的代碼在PHP中應該不會輸出錯誤。無論如何在try&catch塊中顯示PHP異常
try {
throw new Exception('foo');
} catch(Exception $e) {
// here could be some custom functions to handle errors
die();
}
在我的電腦打印
(!) SCREAM: Error suppression ignored for
(!) Exception: foo. in D:\wamp\www\index.php on line 4
爲什麼?哪個php ini選項可以實現這一點?
的error_reporting,的display_errors? –
我想顯示我的錯誤,我不想將_display_errors_設置爲_off_。這個簡單的代碼塊以前沒有打印任何錯誤,而代碼'$ e = 5/0;'確實打印了一個錯誤(如果只是它在try&catch塊中不存在) – jtompl
好吧,將display_errors設置爲on並將error_reporting設置爲E_ALL 。它會顯示所有錯誤。 –