Associated files: myerrorhandler.php (previous)
Test the custom handling of the notification level error first:
testerrorhandler.php
<? PHP require_once ' myerrorhandler.php '; error_reporting ( -1); Set_error_handler (array(' MyErrorHandler ', ' deal ')); // Notification level Error Echo $notice;
Run, generate NoticeLog.log in D:\practise\php\From\notice:
A notification error occurred, as follows: the file that generated the notification: D: \practise\php\from\testerrorhandler. PHP generated notification information: Undefined variable: notice The line number that generatedthe notification: 7 The time that the notification was generated:2015-06-14 11:21:29;
When you test for warnings and fatal levels of errors, you need to configure the messaging system to send messages to the administrator when an error occurs (see: PHP Error and exception notes and summary (7) Send the error log by mail).
The following level of errors cannot be handled by user-defined functions E_ERROR
: E_PARSE
E_CORE_ERROR
, E_CORE_WARNING
E_COMPILE_ERROR
,,,, E_COMPILE_WARNING
, and most E_STRICT
of the files produced in the file where the set_error_handler () function is called.
Reference: Windows PHP sendmail Configuration implementation
PHP error and exception notes and summary (10) Error processor test