Error_reporting () function usage, errorreporting
The error_reporting () function is used to set the error level and return the current level. It has 14 error levels, as shown below:
1 E_ERROR: Fatal runtime error. The error cannot be recovered. Script Execution is paused
2 E_WARNING non-fatal runtime error. Script Execution will not stop
4. parsing error during E_PARSE compilation. Parsing errors should only be generated by the analyzer
8 E_NOTICE running time notification.
16 E_CORE_ERROR is a fatal error when PHP is started. This is like an E_ERROR at the PHP core.
32 E_CORE_WARNING non-fatal error during PHP startup. This is like a warning on PHP core E_WARNING.
64 E_COMPILE_ERROR: Fatal compile-time error. This is like an E_ERROR generated by the Zend script engine.
128 E_COMPILE_WARNING non-fatal compile-time error. The Zend script engine generates an E_WARNING warning.
256 E_USER_ERROR fatal user-generated error.
512 E_USER_WARNING non-fatal user-generated warning.
1024 E_USER_NOTICE user-generated notifications.
2048 E_STRICT running time notification.
4096 E_RECOVERABLE_ERROR capture fatal errors.
8191 E_ALL for all errors and warnings.
It seems that php is disabled by default, so you need to configure the php. ini file:
Change display_errors = Off TO display_errors = On.
In addition, the error level must be configured: Set
Change error_reporting = E_ALL:
Error_reporting = E_ALL &~ E_NOTICE
It should be because php displays all errors by default, and some harmless prompts do not need to be displayed, so set as above!
You can also use the following code in php:
- <? Php
- // Disable the error report, that is, do not display the error
- Error_reporting (0 );
- // Report running errors
- Error_reporting (E_ERROR | E_WARNING | E_PARSE );
- // Report all errors
- Error_reporting (E_ALL );
- ?>