Home  >  Article  >  Backend Development  >  How to open or close error prompts in php

How to open or close error prompts in php

王林
王林Original
2019-09-09 09:35:435390browse

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);

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!

Statement:
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
Previous article:Scope of php constantsNext article:Scope of php constants