Error_reporting () function usage, errorreporting

Source: Internet
Author: User

Error_reporting () function usage, errorreporting

The error_reporting () function is used to set the error level and return the current level. It has 14 error levels, as shown below:

1 E_ERROR: Fatal runtime error. The error cannot be recovered. Script Execution is paused
2 E_WARNING non-fatal runtime error. Script Execution will not stop
4. parsing error during E_PARSE compilation. Parsing errors should only be generated by the analyzer
8 E_NOTICE running time notification.
16 E_CORE_ERROR is a fatal error when PHP is started. This is like an E_ERROR at the PHP core.
32 E_CORE_WARNING non-fatal error during PHP startup. This is like a warning on PHP core E_WARNING.
64 E_COMPILE_ERROR: Fatal compile-time error. This is like an E_ERROR generated by the Zend script engine.
128 E_COMPILE_WARNING non-fatal compile-time error. The Zend script engine generates an E_WARNING warning.
256 E_USER_ERROR fatal user-generated error.
512 E_USER_WARNING non-fatal user-generated warning.
1024 E_USER_NOTICE user-generated notifications.
2048 E_STRICT running time notification.

4096 E_RECOVERABLE_ERROR capture fatal errors.

8191 E_ALL for all errors and warnings.

It seems that php is disabled by default, so you need to configure the php. ini file:

Change display_errors = Off TO display_errors = On.

In addition, the error level must be configured: Set

Change error_reporting = E_ALL:

Error_reporting = E_ALL &~ E_NOTICE

It should be because php displays all errors by default, and some harmless prompts do not need to be displayed, so set as above!

You can also use the following code in php:

 

    1. <? Php
    2. // Disable the error report, that is, do not display the error
    3. Error_reporting (0 );
    4. // Report running errors
    5. Error_reporting (E_ERROR | E_WARNING | E_PARSE );
    6. // Report all errors
    7. Error_reporting (E_ALL );
    8. ?>

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.