Home >Backend Development >PHP Tutorial >Detailed introduction to error interception
In daily development, most people's approach is to turn on debugging mode in the development environment and turn off debugging mode in the production environment. You can check various errors and exceptions during development, but turn off the error display online. The above situation seems very scientific. Some people explain that it is very safe. Others cannot see the error and avoid leaking important information... But have you ever encountered this situation? It works fine offline, but it doesn't work when you go online and you can't find the reason... A script has been running for a long time without any problems. One day it suddenly stopped, and then there was no record for any reason... When we make a payment online, someone else clearly paid, but we didn't record it. It's good to experiment by ourselves... All of the above are due to everyone turning off error messages and not recording errors and exceptions in the log, making it difficult to track randomly occurring errors. This creates a contradiction, that is, not to display errors, but also to track errors. How is this achieved? The above problems can be solved through PHP's error and exception mechanism and its built-in functions 'set_exception_handler', 'set_error_handle
1. PHP's various exception and error interception methods and when fatal errors occur Alarm_php example
#Introduction: In daily development, most people's approach is to turn on debugging mode in the development environment and turn off debugging mode in the production environment. You can check various errors and exceptions during development, but turn off the error display online
Introduction: In daily development, most people's approach is to turn on debugging mode in the development environment and turn off debugging mode in the production environment. You can check various errors and exceptions during development, but turn off the error display online
3. PHP custom error interception
Introduction: PHP custom error interception
[Related Q&A recommendations]:
The above is the detailed content of Detailed introduction to error interception. For more information, please follow other related articles on the PHP Chinese website!