Home >Backend Development >PHP Problem >How to enable error prompts in php

How to enable error prompts in php

王林
王林Original
2020-08-06 13:58:232899browse

How to enable error prompts in php: You can directly use the ini_set() function to enable it. [ini_set("display_errors", "On")] means turning on error prompts; [ini_set("error_reporting",E_ALL)] means displaying all errors.

How to enable error prompts in php

Generally we do not modify the php.ini file directly. You can add the following two lines of code to the php file:

(Recommended tutorial: php graphic tutorial)

ini_set("display_errors", "On");//打开错误提示
ini_set("error_reporting",E_ALL);//显示所有错误

The most common settings of error_reporting:

(Video tutorial recommendation:Introduction to Programming)

E_ALL (显示所有错误,警告和通知,包括编码标准。)
E_ALL & ~E_NOTICE  (显示所有错误,通知除外)
E_ALL & ~E_NOTICE & ~E_STRICT  显示所有错误,通知和编码标准警告除外。)
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (仅显示错误)

The above is the detailed content of How to enable 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