data-id="1190000005075466" data-license="nd">
<code>try{}catch(Exception $e){} </code>
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:
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.