How to open or close error prompts in php

王林
Release: 2023-02-23 19:42:01
Original
5385 people have browsed it

How to open or close error prompts in php

There are two ways to open error prompts in php:

1. Modify the php.in file

in the file directory Find the php configuration file, which is php.ini.

Look for the 'display_errors' keyword in php.in and find 'display_errors = Off ' or 'display_errors = On'. Off means turning off the error prompt. On turns on the error prompt, which can be modified according to your needs.

2. Use the error_reporting() function

Syntax:error_reporting(report_level)

report_level: optional. Specifies the error reporting level for the current script. Both value numbers and constant names are accepted, however, for compatibility with future PHP versions, it is recommended to use constant names.

Usage:

//禁用错误报告
error_reporting(0);
//报告运行时错误
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//报告所有错误
error_reporting(E_ALL);
Copy after login

For more related questions, please visit the php Chinese website: PHP video tutorial

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

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