Disable the Notice warning method in the default PHP settings. The default setting is notice.

Source: Internet
Author: User

Disable the Notice warning method in the default PHP settings. The default setting is notice.

The default setting of PHP is to display the Notice warning prompt, which will cause the page to fail to display normally. You can directly use undefined variables. However, PHP compilation is not as strict as C ++, which is often used in programming.
When I deploy my PHP program that I have worked hard to write on the server, I believe this reminds many people that:

PHP Notice: Undefined variable PHP Notice: Undefined index

Let's take a look. You can directly use undefined variables. However, PHP compilation is not as strict as C ++, which is often used in programming. The default setting of PHP is to display these prompts, which will cause the page to fail to display normally.

// Error_reporting (E_ALL); error_reporting (E_ALL | ~ E_NOTICE); // display all error messages except E_NOTICE

The first one is to show all the errors,
The second is to display all errors without warning,
We only need to add // in front of the second line and remove the // in front of the first line.

Appendix: detailed error reports
Usage:

Error_reporting (0); // Disable Error Report error_reporting (E_ALL ^ E_NOTICE); // display all error messages except E_NOTICE error_reporting (E_ALL ^ E_WARNING ^ E_NOTICE ); // display all error messages except E_WARNING E_NOTICE error_reporting (E_ERROR | E_WARNING | E_PARSE); // display runtime errors, which are the same as error_reporting (E_ALL ^ E_NOTICE. Error_reporting (E_ALL); // display all errors

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.