First of all, you must know that the error_reporting() function is used to set the error level and return the current level. It has 14 error levels as follows:
1 E_ERROR Fatal runtime error. The error cannot be recovered from. Execution of the script was suspended
2 E_WARNING Non-fatal runtime error. The execution of the script will not stop
4 E_PARSE Compilation time parsing error. Parsing errors should only be generated by the analyzer
8 E_NOTICE runtime notifications.
16 E_CORE_ERROR Fatal error when starting PHP. This is like an E_ERROR
32 in the PHP core E_CORE_WARNING A non-fatal error at PHP startup. This is like an E_WARNING warning
64 E_COMPILE_ERROR fatal compile-time error in PHP core. This is like an E_ERROR
128 E_COMPILE_WARNING non-fatal compile-time error generated by the Zend Scripting Engine, and an E_WARNING warning
256 E_USER_ERROR fatal user-generated error generated by the Zend Scripting Engine.
512 E_USER_WARNING Non-fatal user-generated warning.
1024 E_USER_NOTICE User-generated notification.
2048 E_STRICT Notification of running time.
4096 E_RECOVERABLE_ERROR Catches fatal errors.
8191 E_ALL for all errors and warnings.
It seems that php is not enabled by default, so you need to configure the php.ini file:
Change display_errors = Off to display_errors = On
Also configure the error level: change
error_reporting = E_ALL changed to:
error_reporting = E_ALL & ~E_NOTICE
It should be that PHP displays all errors by default, and we do not need to display some harmless prompts, so the settings are as above!
can also be used in php code as follows: