try{}catch(Exception $e){} in php It is not omnipotent, because it can only catch exceptions, but not PHP-level errors. If you want to capture PHP-level errors and handle them like exceptions, the method is as follows: set_error_handler(function($errno, $errmsg) {var_dump($errno,"/> try{}catch(Exception $e){} in php It is not omnipotent, because it can only catch exceptions, but not PHP-level errors. If you want to capture PHP-level errors and handle them like exceptions, the method is as follows: set_error_handler(function($errno, $errmsg) {var_dump($errno,">

Home >Backend Development >PHP Tutorial >Remember how to handle PHP level errors. PHP concurrent processing. PHP queue processing for high concurrency. PHP processing json data.

Remember how to handle PHP level errors. PHP concurrent processing. PHP queue processing for high concurrency. PHP processing json data.

WBOY
WBOYOriginal
2016-07-29 08:50:501231browse

data-id="1190000005075466" data-license="nd">

<code>try{}catch(Exception $e){}
</code>
in

php is not omnipotent, because it can only catch exceptions, but not PHP-level errors.

If you want to capture PHP-level errors and handle them like exceptions, the method is as follows:

<code>
set_error_handler(function($errno, $errmsg) {
    var_dump($errno, $errmsg);
    // Any other Do
});
</code>

Error reporting attempt:

<code>$a = 1/0;
</code>

Obtained results:

<code>int(2) string(16) "Division by zero"
</code>

Reference:

  1. A Q&A on this site

The above introduces how to handle a PHP level error, including the handling method and PHP content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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