TShopping

 找回密碼
 註冊
搜索
查看: 170|回復: 0
打印 上一主題 下一主題

[教學] PHP7 運行出現Notice : Use of undefined constant 的解決方法

[複製鏈接]
跳轉到指定樓層
1#
發表於 2023-10-6 17:29:18 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
問題:
  1. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant page - assumed 'page' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/includes/page.class.php on line 8
  2. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant pageft - assumed 'pageft' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/includes/page.class.php on line 9
  3. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant ALL_PS - assumed 'ALL_PS' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/modules/shopcart/admin/admin_global.php on line 8
  4. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant uid - assumed 'uid' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/modules/shopcart/admin/admin_global.php on line 11
  5. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant shell - assumed 'shell' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/modules/shopcart/admin/admin_global.php on line 12
  6. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant username - assumed 'username' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/modules/shopcart/admin/includes/action.class.php on line 22
  7. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant passwd - assumed 'passwd' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/modules/shopcart/admin/includes/action.class.php on line 22
  8. [06-Oct-2023 17:18:12 Asia/Taipei] PHP Warning:  Use of undefined constant m_id - assumed 'm_id' (this will throw an Error in a future version of PHP) in /home/pipe/public_html/modules/shopcart/admin/includes/action.class.php on line 28
複製代碼
問題描述;

       進入網站會出現大量類似下面的提示,但是可以正常顯示和運行.

最大的問題是LOG檔案占空間,沒多久就數十GB

答案

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

關閉 PHP 提示的方法

  搜尋php.ini:

  error_reporting = E_ALL

  改為:

  error_reporting = E_ALL & ~E_NOTICE

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

  在每個文件頭上加

  error_reporting(0); 雖然不好弄但是可以解決問題.



 

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

本版積分規則



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

GMT+8, 2024-4-29 12:15 , Processed in 0.055273 second(s), 22 queries .

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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