set_error_handler()设置时禁用错误通知

时间:2013-09-24 00:38:07

标签: php error-handling mpdf

我有一个自定义set_error_handler()设置,而且我正在使用mPDF,它一直给我错误。

我的自定义错误处理程序:

function error_handler($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 = 'From: '.ADMIN_EMAIL.'\r\n';
$headers .= "Subject: Error from ".SITE_NAME."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Email the error to the webmaster  
error_log($email, 1, ERROR_EMAIL, $headers);  
// Make sure that you decide how to respond to errors (on the user's side)  
// Either echo an error message, or kill the entire project. Up to you...  
// The code below ensures that we only "die" if the error was more than  
// just a NOTICE.   
if ( ($number !== E_NOTICE) && ($number < 2048) ) {  
    die("Oops! Looks like there was an error on this page. Please go back to the page you were on and try again later.<br />If problems persist please contact us at <a href=\"mailto:".ADMIN_EMAIL."\">".ADMIN_EMAIL."</a>");  
}  

}

文件MPDF56/classes/cssmgr.phpMPDF56/mpdf.php一直在调整Undefined index错误,即使我已将error_reporting(0);添加到这两个页面的顶部,我仍然会收到报告并且它限制了我的PDF输出并用每封PDF约9000封(即999封)电子邮件填写我的电子邮件。

有谁知道如何禁用这些页面的错误日志?我仍然希望使用自定义set_error_handler()为我网站的其余部分获取它们。

0 个答案:

没有答案