Php errors mainly fall into the following three categories: 1. Syntax error programs usually display error messages (errors) during execution ). This type of error will prevent php scripts on the page from executing other tasks. For example, & lt ;? PhpEcho100.Echo100; Echo101 ;? & Gt; execution result Parse... SyntaxHighlight
Php errors mainly fall into the following three categories:
1. Syntax error
In this case, the program usually displays an error message (error) during execution ). This type of error will prevent php scripts on the page from executing other tasks. For example:
Echo 100.
Echo 100;
Echo 101;
?>
Execution result
Parse error: syntax error, unexpected ';' in...
2. runtime error
Php scripts will not be blocked, but they will be prevented from doing what they want. As follows:
Echo "this is a demo ";
Header ('Location: http://www.example.com /');
// No output header () must be called before any actual output
?>
Execution result:
This is a demo
Warning: Cannot modify header information-headers already sent by (output started at E: \ PhpProject1 \ test. php: 7) in E: \ PhpProject1 \ test. php on line 8
3. program logic error
This error will not stop php script execution, but will not display the error message. The debugging procedure is generally used to handle exceptions. for example
$ A = 5;
If ($ a = 6 ){
Echo $;
}
?>
The running result is 6.
Error severity:
ERROR
The page script stops running.
WARNING
Page script does not stop running
NOTICE
Page script does not stop running
/*
* Ini_set ()
* Error_reporting ()
* Header ()
*
*/
Header ("Content-type: text/html; charset = utf-8 ");
Echo $ a; // Notice: Undefined variable:
Echo"
++
";
Echo "this is a Notice: Undefined variable ";
Echo"
";
Var_dump ();
Echo"
++
";
Echo "This ia a Warning level Warning: Wrong parameter count for var_dump ()...";
Echo"
";
Ech "This is a demo ";
Echo"
++
";
Echo "This ia a Warning level Warning: Wrong parameter count for var_dump ()...";
?>
Ini_set ()
Sets the value of a configuration option
String ini_set (string $ varname, string $ newvalue)
Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.
Assign a value to the configuration option that is given (specified). during program execution, the configuration option will always use the new value. When the program execution is complete, the configuration option restores the default value of the system.
Ini_set ('display _ errors ', 1); enable display_errors in php. ini
Error_reporting (E_ALL );
All errors, warnings, and notes of the error program are reported.
Error_reporting (E_ALL );
Ini_set ('display _ errors ', 1 );
Author: "My PHP path"