1, in the script can be configured with the following syntax to configure the php.ini:
Syntax:ini_set ("Set Item Name", value)
For example:ini_set ("Display_errors", false); Do not display all error messages
2. Configure in the php.ini file:
Locate the ER ror_reporting option in the file, such as:
Error_reporting=e_all | E_strict Open All error message prompts (with logical or open meaning), if you want to close some hints again with Error_reporting=e_all | E_strict & ~e_strict ("& ~" means closed)
3,log_error=on;//used to set whether the error log is logged, on record, OFF does not log
4,error_log= "error log file name" //Set the error log file name
such as:error_log = Php_errors.log
5,log_error = syslog; Record error messages in the operating system
6. Custom error Handling
- 1, set the name of the custom function used to handle the error;: Set_error_handler ("function name");
Set_error_handler("Myerror");
2, you define the function, and make any error message output (or record), customize the function with four parameters (parameter name can be changed, but the order cannot be changed, the function does not call itself, but release error will automatically call):function ErrorHandler ($errNo, $ERRMSG, $errFile, $errLine) {...}
function Myerror ($errNo, $ERRMSG, $errFile, $errLine) {
An error occurred on line ($errLine) of the echo "file ($errFile):";
echo "<br/> Error Number: $errNo, error message: $ERRMSG";
}
Echo $vi;
Trigger_error ("Age error, re-entry", e_user_warning);
PHP.ini configuration in a php script file