Fatal error is generally not required to capture, but in a complex program, if the occasional lack of memory causes Fatal error is difficult to deal with.
Like what. Fatal error out in the MySQL class when the fetch. It's difficult to pinpoint the real problem at this time.
PHP exception handling can be captured by Set_error_handler. But can only catch notice/warning level of error, for E_error is powerless.
Register_shutdown_function can solve the shortage of set_error_handler.
By registering the program end callback function with this function, you can catch errors that are not normally captured. Then the error is judged by Error_get_last. It's easy to find a problem that's difficult to locate.
Copy Code code as follows:
function Shutdown_function ()
{
$e = Error_get_last ();
Print_r ($e);
}
Register_shutdown_function (' shutdown_function ');