How to effectively implement blocking PHP error _php tutorial

Source: Internet
Author: User
Tags php error

Block PHP Error Tip method One, add @ before a function that is likely to go wrong, and then or Die ("")
Such as:
@mysql_connect (...) or Die ("Database Connect Error")

Block PHP Error Prompt method Two, edit php.ini, look for "display_errors =", change the value after "=" to "off."

Block PHP Error Prompt method Three, add error_reporting (0) before the php script, and block all error prompts.

Error_reporting
Configure the level of error message return.

Syntax: int error_reporting (int [level]);

return value: Integer

Function type: PHP system function

Block PHP error prompt function content description

This function is used to configure the level of return of error information, and the bitmask is the bit mask of an integer, as shown in the table below.

Mask value represents name

E_error
E_warning
E_parse
E_notice
E_core_error
E_core_warning

E_notice indicates that the general situation is not recorded and only used if the program has an error condition, such as attempting to access a nonexistent variable or calling the stat () function to view a nonexistent file.
E_warning are usually displayed, but the execution of the program is not interrupted. This is very effective for debugging. For example: Call Ereg () with a problematic regular expression.
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 parsing errors 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.

error_reporting (7) = error_reporting (1+2+4) = error_reporting (E_error | e_waring | E_parse)

The above is to block PHP error prompt related implementation method.


http://www.bkjia.com/PHPjc/445954.html www.bkjia.com true http://www.bkjia.com/PHPjc/445954.html techarticle Block PHP Error Prompt method One, add @ before a function that is likely to go wrong, and then or die () such as: @mysql_connect (...) or Die (Database connect error) block PHP Error Prompt method Two, edit ...

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