Today because of contact with a framework, various try,catch. Throws a fatal error and a syntax error to 500. Try,catch is unable to catch the wrong. And then use the next register_shutdown_function This method, very good
The principle of this method is to call it once before the end of the PHP process. So with Error_get_last(this method, by definition, returns the last error) can be a good catch fatal error
Register_shutdown_function (' shutdown_function ');
Try
{
$a = new A ();//This will report fatal error
Echo 5/0;
}
catch (Exception $e)
{
echo ' exception capture ';
Print $e->getmessage ();
}
function shutdown_function ()
{
echo ' catch error ';
$e = Error_get_last ();
Print_r ($e);
Here I started making a mistake by writing register_shutdown_function to the end. Because the PHP code was executed from beginning to end, the process was interrupted by a fatal error before it was executed to your method, so put him in the beginning