龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

PHP 出現(xiàn)Notice: Use of undefined constant 的解決方案

2015.09.10 | 96閱讀 | 0條評論 | php

網(wǎng)站會出現(xiàn)大量類似下面的提示,但是可以正常顯示和運行

Notice: Use of undefined constant ctbTitle - assumed ‘ctbTitle’ in d:\ctb1.5\ctb\include\config.php on line 23…?
答案:這些是 PHP 的提示而非報錯,PHP 本身不需要事先聲明變量即可直接使用,但是對未聲明變量會有提示。一般作為正式的網(wǎng)站會把提示關(guān)掉的,甚至連錯誤信息也被關(guān)掉 關(guān)閉 PHP 提示的方法 搜索php.ini:
error_reporting = E_ALL
改為:
error_reporting = E_ALL & ~E_NOTICE
重啟web服務(wù)器,設(shè)置即可生效。

贊 (

發(fā)表評論