Home > Backend Development > PHP Tutorial > Introduction to how to display error prompts in PHP_PHP Tutorial

Introduction to how to display error prompts in PHP_PHP Tutorial

WBOY
Release: 2016-07-13 10:56:16
Original
914 people have browsed it

The following introduces a method to enable Wusu City prompts in php. Friends in need can refer to it.

1: php.ini configuration

There are two configuration variables related to this in the php.ini configuration. Here are the two variables and their default values:


The following is a quote:

The code is as follows
 代码如下 复制代码

display_errors = Off
error_reporting = E_ALL & ~E_NOTICE

Copy code


display_errors = Off

error_reporting = E_ALL & ~E_NOTICE

 代码如下 复制代码

display_errors = On


The purpose of the display_errors variable is obvious - it tells PHP whether to display errors. The default value is Off. Now our purpose is to display an error message, then:

The following is a quote:

The code is as follows
 代码如下 复制代码

1 E_ERROR 
2 E_WARNING 
4 E_PARSE 
8 E_NOTICE 
16 E_CORE_ERROR 
32 E_CORE_WARNING 
64 E_COMPILE_ERROR 
128 E_COMPILE_WARNING 
256 E_USER_ERROR 
512 E_USER_WARNING 
1024 E_USER_NOTICE 
6143 E_ALL 
2048 E_STRICT 
4096 E_RECOVERABLE_ERROR

Copy code
display_errors = On

E_ALL, this setting displays everything from bad coding practices to harmless tips to errors. E_ALL is a bit too detailed for the development process, because it displays a prompt even if the variable is not initialized, and this is a feature of "advanced" PHP. Fortunately, the default value of error_reporting is "E_ALL & ~E_NOTICE", so you will only see errors and bad encoding, and no prompts that are not harmful to the program will be displayed. After modifying php.ini, you need to restart Apache so that it can take effect in apache. Of course, if you only test the program on the command line, you do not need this step. Enemy value macro definition
The code is as follows Copy code
1 E_ERROR 2 E_WARNING 4 E_PARSE 8 E_NOTICE
16 E_CORE_ERROR
32 E_CORE_WARNING 64 E_COMPILE_ERROR 128 E_COMPILE_WARNING 256 E_USER_ERROR 512 E_USER_WARNING 1024 E_USER_NOTICE 6143 E_ALL 2048 E_STRICT 4096 E_RECOVERABLE_ERROR http://www.bkjia.com/PHPjc/632168.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632168.htmlTechArticleThe following introduces a method to enable Wusu City prompts in php. Friends in need can refer to it. 1: php.ini configuration There are two configuration variables related to this in the php.ini configuration. Here is this...
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