Home >Backend Development >PHP Tutorial >Solution to PHP Notice: Undefined variable_PHP Tutorial
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