Home >Backend Development >PHP Tutorial >Solution to PHP Notice: Undefined variable_PHP Tutorial

Solution to PHP Notice: Undefined variable_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:14:351009browse

Notice: Undefined variable: email in D:PHP5ENOTEADDNOTE.PHP on line 9

Notice: Undefined variable: subject in D:PHP5ENOTEADDNOTE.PHP on line 9

Notice: Undefined variable: comment in D:PHP5ENOTEADDNOTE.PHP on line 9

 ...

In fact, the above is an undefined variable, we will directly determine the code of the variable.

Originally, php does not need to define variables, but what should you do if this happens?

Just find the

of php.ini in C:WINDOWS and in php .ini line 302 error_reporting = E_ALL

Modify to

error_reporting = E_ALL & ~E_NOTICE and then restart apache2.2

Solution: Modify php.ini

Modify: error_reporting = E_ALL

to: error_reporting = E_ALL & ~E_NOTICE

If you don’t want any errors to be displayed, directly modify:

display_errors = Off

If you do not have permission to modify php.ini, you can add

in the php header ini_set("error_reporting", "E_ALL & ~E_NOTICE");

That is Yes

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326269.htmlTechArticleNotice: Undefined variable: email in D:PHP5ENOTEADDNOTE.PHP on line 9 Notice: Undefined variable: subject in D: PHP5ENOTEADDNOTE.PHP on line 9 Notice: Undefined variable: comm...
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