How to customize error function in php

coldplay.xixi
Release: 2023-03-04 13:34:01
Original
2466 people have browsed it

How to customize the error function in php: 1. Write an error handling function with fixed parameters, which is [$errno, $errstr]; 2. Set the error handling method [set_error_handler()].

How to customize error function in php

How to customize error function in php:

1) Write an error handling function and name the function yourself , but the parameters are fixed, $errno, $errstr, where the former defaults to the error level, and the latter is the specific information of the error.

2) Set the error handling method. set_error_handler("The error handling function you named yourself."); In this way, all errors will be handled in the way you set. In addition, if you only control a certain type of error handling:

3) Set the error handling method. set_error_handler("The error handling function you named yourself.", some fixed constants); In this, the fixed constants are set by PHP and represent different error registrations, including:E_WARNING, E_NOTICEWait

Relevant learning recommendations:php programming(video)

The above is the detailed content of How to customize error function in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
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!