0

我有一个自定义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 的输出并用大约 9000(没错,9000)填充我的电子邮件通过电子邮件发送每个 PDF。

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

4

0 回答 0