Home > Article > Backend Development > How to use try/catch in php7
1. The error is thrown directly here, but it is not caught.
2. The variable $a here is not declared
3. Use the symbol "@" to suppress errors
4. Set user-defined settings through the function set_exception_handler() Exception handling function
5. Set the user-defined error handling function through the function set_error_handler()
6. Use multiple catches to capture different types of errors, and use to organize the operations after exception capture
Recommended tutorial: PHP video tutorial
The above is the detailed content of How to use try/catch in php7. For more information, please follow other related articles on the PHP Chinese website!