Detailed introduction to error interception

巴扎黑
Release: 2023-03-09 17:24:01
Original
950 people have browsed it

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

2. How to intercept various PHP exceptions and errors and their fatal occurrences Alarm when errors occur_PHP

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

Detailed introduction to 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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!