This article provides a detailed analysis of the methods used to capture php error messages. For more information, see
This article provides a detailed analysis of the methods used to capture php error messages. For more information, see
PS:
1. Catch PHP syntax errors
2. Serious errors
Normal set_error_handle cannot capture these two types of errors: Hong Kong virtual hosts and server space. This is a technique for capturing such errors.
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
Output test. php to print out
Array ([type] => 4 [message] => parse error [file] => D: \ web \ tbc \ error_test.php [line] => 5)
Then you can write logs based on $ msg.
, Server space