Usage of error_reporting () function in PHP (Modify PHP Mask error)

Source: Internet
Author: User
Tags codeigniter

Generally in the default normal php file output an undefined declaration of the variable is not reported wrong, but in the CodeIgniter framework to report errors, which for the integration to add and modify the page in one of the "lazy" is very inconvenient, Because it is a beginner, how do you want to block this error in the code? Even with the @, but listen to a lot of people say @ will greatly reduce performance ....

Finally suddenly thought, is not codeigniter intentionally let this error message out, how should we go to block this kind of error? accidentally searched "How to let CodeIgniter not show notice information?", Enlightened. The original is the entrance index.php in the error_reporting (E_all); just change it to
Error_reporting (e_all ^ e_notice);
You can block out this error without affecting other errors.

Below are some of the information that we searched for:

Error_reporting () Sets the error level for PHP and returns the current level.

Grammar
Error_reporting (Report_level)
If the parameter level is not specified, the current error levels are returned. The following items are possible values for level:

1 E_error
2 e_warning
4 E_parse
8 E_notice
E_core_error
E_core_warning
E_compile_error
E_compile_warning
E_user_error
E_user_warning
1024x768 E_user_notice
2047 E_all
2048 e_strict
E_notice indicates that the general situation is not recorded and is only used if the program has an error condition, such as attempting to access a nonexistent variable, or calling stat () to view files that do not exist.

E_warning are usually displayed, but do not interrupt the execution of the program. This is very effective for debugging. For example: Call Ereg () with a problematic regular representation.

The e_error is usually displayed, and the program execution is interrupted. This mask cannot be traced to a memory configuration or other error.

E_parse parse the error from the syntax.
E_core_error is similar to E_error, but does not include errors caused by PHP core.
E_core_warning similar to e_warning, but does not include PHP core error warnings.

Use of the error_reporting () function in PHP (Modify PHP masking 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.