PHP turn on and off error tips

Source: Internet
Author: User
Tags php error

There are two ways to open and close the PHP error prompt, one in the php.ini configuration file. The other is the use of function Ini_set () and error_reporting () settings in PHP files.

1. Find the display_errors in php.ini, set the error prompt to turn on and off, off and on. Setting the Error_reporting value also represents the wrong level.

Some common values

E_all (Show all errors, warnings and notices including coding.) All errors
E_all & ~e_notice (Show all errors, except for notices) except notification, all errors
2. If you cannot modify the php.ini file, PHP also provides the relevant functions to dynamically configure.

Ini_set (' display_errors ', ' off '), turning off error prompts.

Ini_set (' display_errors ', ' on '); Open the error prompt.

Error_reporting (E_all & ~e_notice) sets the error level.

Some common frameworks, or CMS systems, use these two functions to control the display of PHP errors.

Implementation in micro-engine

Define (' DEVELOPMENT ', $_w[' config '] [' setting '] [' DEVELOPMENT '] = = 1);
if (DEVELOPMENT) {
Ini_set (' display_errors ', ' 1 ');
Error_reporting (e_all ^ e_notice);
} else {
error_reporting (0);
}

Dream Weaving

include/common.inc.php


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.