php method to eliminate alerts: First create a PHP sample file; then use the "error_reporting()" function to turn off the warning error, with a code such as "error_reporting(E_ALL^E_WARNING);".
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
Common reasons for WARNING errors in PHP:
Cannot connect to the database
Create a new PHP document. Since the username and password for connecting to the data are incorrect, a WARNING warning error will be generated
Warning level warning errors are non-fatal and do not affect subsequent code execution
Use the error_reporting() function to turn off warning warnings Error, example:
error_reporting(E_ALL^E_WARNING);
After setting, the PHP script will ignore this error, and the subsequent code will execute normally
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to eliminate alert in php. For more information, please follow other related articles on the PHP Chinese website!