PHP自定义错误处理和电子邮件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP自定义错误处理和电子邮件相关的知识,希望对你有一定的参考价值。
Refer here for a full overview: http://net.tutsplus.com/tutorials/php/quick-tip-email-error-logs-to-yourself-with-php/
<?php // Our custom error handler function nettuts_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 the error to someone... // 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) ) { } } // We should use our custom function to handle errors. // Trigger an error... (var doesn't exist) echo $somevarthatdoesnotexist;
以上是关于PHP自定义错误处理和电子邮件的主要内容,如果未能解决你的问题,请参考以下文章