TShopping

 找回密碼
 註冊
搜索
查看: 2392|回復: 0

[教學] PHP錯誤Notice : Use of undefined constant 的完美解決方法_PHP教程

[複製鏈接]
發表於 2020-9-16 14:24:29 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
本文為大家講解的是PHP錯誤Notice : Use of undefined constant 的完美解決方法,這個php的非致命錯誤提醒在pph5.3以上的版本中出現的頻率非常好,主要是因為php.ini中的錯誤級別配置的問題,感興趣的同學參考下.

本文為大家講解的是PHP錯誤Notice : Use of undefined constant 的完美解決方法,這個php的非致命錯誤提醒在php5.3以上的版本中出現的頻率非常好,主要是因為php.ini中的錯誤級別配置的問題.

問題說明:
會快速造成磁碟空間滿載,導致系統無法正常使用.
  1. cat /var/log/httpd/error_log
複製代碼

PHP,Notice,解決方法,PHP教程,CentOS

PHP,Notice,解決方法,PHP教程,CentOS

  1. PHP Notice:  Use of undefined constant eng_name - assumed 'eng_name' in /home/www/showasr601.php on line 19
  2. PHP Notice:  Use of undefined constant status - assumed 'status' in /home/www/showasr601.php on line 19
  3. PHP Notice:  Use of undefined constant eventtime - assumed 'eventtime' in /home/www/showasr601.php on line 18
  4. PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/www/showasr601.php on line 18
  5. PHP Notice:  Use of undefined constant eng_name - assumed 'eng_name' in /home/www/showasr601.php on line 19
  6. PHP Notice:  Use of undefined constant status - assumed 'status'
複製代碼


進入網站會出現大量類似下面的提示,但是可以正常顯示和執行
  1. PHP Notice:  Use of undefined constant eng_name - assumed 'eng_name'
複製代碼


PHP 的提示而非報錯,PHP 本身不需要事先宣告變數即可直接使用,但是對未宣告變數會有提示。一般作為正式的網站會把提示關掉的,甚至連錯誤資訊也被關掉

關閉 PHP 提示的方法

搜尋php.ini:

  1. error_reporting = E_ALL
複製代碼


改為:

  1. error_reporting = E_ALL &; ~E_NOTICE
複製代碼


還有個不是辦法的辦法就是

在每個檔案頭上加

  1. error_reporting(0);
複製代碼
雖然不好弄但是可以解決問題!!!!!!這個比較好用


參考文章

文章出處:網頁設計,網站架設 ,網路行銷,網頁優化,SEO - NetYea 網頁設計


 

臉書網友討論
*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-3-29 03:58 , Processed in 0.050643 second(s), 26 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表