This article mainly introduces the PHP development encountered in some of the wrong solution, has a certain reference value, now share to everyone, the need for friends can refer to
In the process of debugging the program development, we will always encounter a variety of error , part of the error impact of code execution, part of just give one WARNING or NOTICE , will not affect the following code to continue execution.
PHPAn error control operator is provided in which @ PHP any error information that may result from an expression is ignored until it is placed in an expression. If you want to control the type of output error, you can error_reporting() tell the compiler which error to report by using a function.
int error_reporting ([ int $level ] ): Set what errors should be reported PHP
$levelIs the error level, returns the old [error_reporting] level, or level returns the current level if the parameter is not given.
<?php//Close all PHP error reports error_reporting (0);//Report Simple running errorserror_reporting (E_error | e_warning | E_parse);//Report E_notice is also very good (report uninitialized variables or error spelling of capturing variable names) error_reporting (E_error | e_warning | E_parse | E_notice);//except E_notice, report all other errors error_reporting (e_all ^ e_notice);//Report All PHP errors (see Changelog) error_reporting (E_all) ;//Report All PHP error error_reporting (-1);//And Error_reporting (E_all); As Ini_set (' error_reporting ', e_all);? >
The Levels and constants of the errors are PHP defined in the predefined constants:
Where we are often encountered in the development of,, E_ERROR E_WARNING E_PARSE , E_NOTICE .
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!