Home  >  Article  >  Backend Development  >  How to check error messages in php

How to check error messages in php

王林
王林Original
2020-08-03 13:15:073716browse

How to view error information in php: First use the ini_set() function to turn on the error prompt, such as [ini_set("display_errors", "On")]; then use the error_reporting() function to set the error reporting level.

How to check error messages in php

PHP ini_set is used to set the value of php.ini, which takes effect when the function is executed. After the script ends, the setting becomes invalid. The configuration can be modified without opening the php.ini file.

(Recommended tutorial: php graphic tutorial)

Grammar format:

string ini_set(string $varname, string $newvalue)

error_reporting() function specifies which error to report, the function settings The error reporting level for the current script.

(Video tutorial recommendation: php video tutorial)

Grammar format:

error_reporting(report_level)

Just add the following two lines of code to the execution code.

ini_set("display_errors","On");
error_reporting(E_ALL);

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