A detailed explanation of how to capture PHP error messages_PHP Tutorial

WBOY
Release: 2016-07-21 15:07:30
Original
843 people have browsed it

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

www.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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!