Home >Backend Development >PHP Problem >How to turn off web page error prompts in php

How to turn off web page error prompts in php

王林
王林Original
2020-11-05 09:56:491588browse

php method to turn off web page error prompts: directly add the code [error_reporting(E_ALL^E_NOTICE^E_WARNING);] to the php program, so that all notice and warning level errors can be turned off.

How to turn off web page error prompts in php

Turning off the PHP error script prompt is something that must be done when the program is online. No matter how the program reports an error, we cannot let the error log be posted to everyone on the server. See.

(Video tutorial recommendation: java video tutorial)

The easiest way is to add the following code directly to the php program code:

error_reporting(E_ALL^E_NOTICE^E_WARNING);

This can turn off all notice and warning level errors.

Put this statement in the function include file of your script, usually config.php or conn.php to control the output.

Of course we can also set it in php.ini

1. Open the php.ini file in the PHP installation directory

2. Find display_errors = On and change it to display_errors = off

Note: If you have copied the PHP.ini file to the windows directory, you must also change display_errors = On in c:windows/php.ini to display_errors = off

Related recommendations: php training

The above is the detailed content of How to turn off web page error prompts in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn