How to effectively block PHP error prompts. Method 1 of blocking PHP error prompt: add @ before a function with a possible error, and then ordie () for example: @ mysql_connect (...) ordie (DatabaseConnectError) blocking PHP error message method 2. Editing
Blocking PHP error prompt method 1. add @ before a function with a possible error, and then or die ("")
For example:
@ Mysql_connect (...) or die ("Database Connect Error ")
Method 2: edit PHP. ini, find "display_errors =", and change the value after "=" to "off.
Method 3: Add error_reporting (0) to the PHP script to block all error prompts.
Error_reporting
Configure the error message return level.
Syntax: int error_reporting (int [level]);
Return value: integer
Function types: PHP system functions
Description of function content for blocking PHP error message
This function is used to configure the error message return level. the level parameter is an integer bitmask. See the following table.
Mask value
E_ERROR
E_WARNING
E_PARSE
E_NOTICE
E_CORE_ERROR
E_CORE_WARNING
E_NOTICE indicates that it is not recorded in general cases and used only when the program has an error, for example, an attempt to access a non-existent variable or call the stat () function to view a non-existent file.
E_WARNING is usually displayed, but the execution of the program is not interrupted. This is effective for debugging. For example, call ereg () with a problematic regular expression ().
E_ERROR is usually displayed and the program execution is interrupted. This mask cannot be used to trace memory configurations or other errors.
E_PARSE parsing errors from syntax.
E_CORE_ERROR is similar to E_ERROR, but does not include errors caused by the PHP core.
E_CORE_WARNING is 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 the implementation method for blocking PHP error prompts.
Mongodie () for example: @ mysql_connect (...) or die (Database Connect Error) blocking PHP Error prompt method 2. edit...