Home > Article > Backend Development > Notice: Use of undefined constant appears when running PHP. Perfect solution
Notice: Use of undefined constant title - assumed ‘title’ in F:wampwwwload_myweb.php on line 22
Notice: Use of undefined constant content - assumed 'content' in F:wampwwwload_myweb.php on line 22
A lot of prompts similar to the following will appear when entering the website, but it can be displayed and run normally
Notice: Use of undefined constant title - assumed 'title' in F:wampwwwload_myweb.php on line 22
(http://img.blog.csdn.net/20160304151937245)
These are PHP prompts rather than errors. PHP itself can be used directly without declaring variables in advance, but there will be prompts for undeclared variables. Generally, as an official website, the prompts will be turned off, and even the error messages will be turned off
How to turn off PHP prompt
Search php.ini:
error_reporting = E_ALL
Change to:
error_reporting = E_ALL & ~E_NOTICE
Another alternative is to
Add
to the header of each fileerror_reporting(0); Although it’s not easy to do, it can solve the problem! ! ! ! ! ! This is my favorite.
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });The above introduces the perfect solution for Notice: Use of undefined constant when PHP is running, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.