data-id="1190000005075466" data-license="nd">
try{}catch(Exception $e){}
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:
set_error_handler(function($errno, $errmsg) {
var_dump($errno, $errmsg);
// Any other Do
});
Error reporting attempt:
$a = 1/0;
Obtained results:
int(2) string(16) "Division by zero"
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.