PS:
1. Capture PHP syntax errors
2. Serious errors
These two types of errors cannot be caught with normal set_error_handle. Here are the tricks to catch such errors
Copy the code The code is as follows:
//test.php page
error_reporting(0);
register_shutdown_function('PageOnShutdown');
include('error_test.php');
function PageOnShutdown()
{
$msg = error_get_last();
print_r($msg);
}
//error_test.php page
$a = 1 + 2
$b
Then output test.php and print out
Array ( [type] => 4 [message] => parse error [file] => D:webtbcerror_test .php [line] => 5)
Then write the log operation based on getting $msg
http://www.bkjia.com/PHPjc/327536.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327536.htmlTechArticlePS: 1. Capture PHP syntax errors 2. Serious errors These two types of errors cannot be captured with normal set_error_handle. This is the trick to catch such errors Copy the code code as follows: //test.php page...