Error_reporting () function usage, errorreporting_php tutorial

Source: Internet
Author: User

Error_reporting () function usage, errorreporting


The first thing to know is that the error_reporting () function is used to set the error level and return the current level. It has 14 error levels, as follows:

1 E_error Fatal Run-time error. The error cannot be recovered. Execution of the script is paused
2 e_warning non-fatal run-time error. Execution of the script does not stop
4 E_parse Compile-time parse error. Parsing errors should only be generated by the parser
8 E_notice run time notification.
E_core_error fatal error when PHP is started. This is like a e_error in the PHP core
E_core_warning a non-fatal error when PHP is started. This is like a e_warning warning in PHP core
E_compile_error Fatal compile-time error. This is like a e_error generated by the Zend scripting engine
E_compile_warning non-fatal compile-time error, a e_warning warning generated by the Zend scripting engine
The e_user_error fatal user-generated error.
E_user_warning a non-fatal user-generated warning.
1024x768 E_user_notice user-generated notifications.
2048 e_strict run time notification.

4096 E_recoverable_error catch a fatal error.

8191 E_all to all the errors and warnings.

It seems that PHP does not turn on the error by default, so you need to configure the php.ini file:

Change display_errors = Off to display_errors = On

Also configure the error level:

error_reporting = E_all instead:

error_reporting = E_all & ~e_notice

The default for PHP is to display all errors, and some harmless hints we do not need to display, so set up as above!

You can also use the following in PHP code:

      1. Php
      2. Disable error reporting, i.e. do not display errors
      3. Error_reporting(0);
      4. Report Run-time errors
      5. Error_reporting(e_error | E_warning | E_parse);
      6. Report All Errors
      7. Error_reporting(e_all);
      8. ?>

http://www.bkjia.com/PHPjc/1048723.html www.bkjia.com true http://www.bkjia.com/PHPjc/1048723.html techarticle error_reporting () function usage, errorreporting first know that the error_reporting () function is used to set the error level and return the current level. It has 14 error levels, as follows: 1 e_e ...

  • 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.