There are two ways to open error prompts in php:
1. Modify the php.in file
in the file directory Find the php configuration file, which is php.ini.
Look for the 'display_errors
' keyword in php.in and find 'display_errors = Off ' or 'display_errors = On
'. Off means turning off the error prompt. On turns on the error prompt, which can be modified according to your needs.
2. Use the error_reporting() function
Syntax:error_reporting(report_level)
report_level: optional. Specifies the error reporting level for the current script. Both value numbers and constant names are accepted, however, for compatibility with future PHP versions, it is recommended to use constant names.
Usage:
//禁用错误报告 error_reporting(0); //报告运行时错误 error_reporting(E_ERROR | E_WARNING | E_PARSE); //报告所有错误 error_reporting(E_ALL);
For more related questions, please visit the php Chinese website:PHP video tutorial
The above is the detailed content of How to open or close error prompts in php. For more information, please follow other related articles on the PHP Chinese website!