我使用從NETTUTS以下腳本:這是爲什麼PHP腳本錯誤不是我發送電子郵件的致命錯誤?
// Our custom error handler
function error_engine($number, $message, $file, $line, $vars)
{
$email = "
<p>An error ($number) occurred on line
<strong>$line</strong> and in the <strong>file: $file.</strong>
<p> $message </p>";
$email .= "<pre>" . print_r($vars, 1) . "</pre>";
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Email the error to someone...
error_log($email, 1, '[email protected]', $headers);
if (($number !== E_NOTICE) && ($number < 2048)) {
die("There was an error. Please try again later.");
}
}
// We should use our custom function to handle errors.
set_error_handler('error_engine');
它工作正常的通知和警告等,但,當我故意打破我的腳本,通過改變「mysqli_connect」說「mysqy_connct」我得到的致命錯誤打印在屏幕上,並沒有電子郵件!
就像是超越這種類型的錯誤日誌/報告的範圍錯誤?
我在做什麼錯?
啊好的,謝謝。 – absentx 2012-08-11 18:25:26
@absentx請接受一個答案。 – mAu 2012-08-12 08:10:39