Home  >  Article  >  Backend Development  >  Notice: Use of undefined constant appears when running PHP. Perfect solution

Notice: Use of undefined constant appears when running PHP. Perfect solution

WBOY
WBOYOriginal
2016-07-29 09:00:411635browse

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
PHP运行出现Notice : Use of undefined constant 完美解决方案
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 file

 error_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.

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