Error prompt in PHP _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP shows the error prompt method introduction. The following describes how to enable the USU prompt in php. For more information, see. I. two configuration variables are involved in php. ini configuration. The following describes how to enable the USU prompt in php. For more information, see.

I. php. ini configuration

In the php. ini configuration, there are two configuration variables related to this. The two variables and their default values are as follows:


The following is a reference clip:

The code is as follows:

Display_errors = Off
Error_reporting = E_ALL &~ E_NOTICE


The purpose of the display_errors variable is obvious-it tells PHP whether an error is displayed. The default value is Off. The purpose is to display the error prompt:


The following is a reference clip:

The code is as follows:

Display_errors = On


E_ALL: this setting displays all the information from bad code practices to harmless prompts to errors. E_ALL is a little too detailed for the development process because it displays a prompt even if the variable is not initialized, which is a feature of PHP "advanced. Fortunately, the default value of error_reporting is "E_ALL &~ E_NOTICE ", so that only the error and bad code are displayed, and no negative prompt is displayed for the program.

After modifying php. ini, you need to restart Apache to take effect in apache. of course, if you test the program only in the command line, you do not need this step.

Macro definition of enemy values

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

Bytes. I. two configuration variables are involved in php. ini configuration. Below is this...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.