
最近,将網站運作的硬體進行了更新,從虛拟主機換成了vps,同時,用上最新的寶塔面闆(
基于centos7的6.9版本),php主要是用7.3版本,網上資料說,
wordpress完美支援php7.0及以上版本,那麼現階段選擇php7.3是可以承前啟後的。
附為什麼要選擇php7,因為快;為什麼選擇php7.3,因為其穩定。
一通wordpress搬家操作。域名解析更換且成功後,浏覽網站,出現這麼一大串:
constant gallerytag – assumed ‘gallerytag’ (this will throw an Error in a future version of PHP) in……
constant videotag – assumed ‘videotag’ (this will throw an Error in a future version of PHP) in……
constant taotag – assumed ‘taotag’ (this will throw an Error in a future version of PHP) in……
constant filtersa – assumed ‘filtersa’ (this will throw an Error in a future version of PHP) in constant filtersb – assumed ‘filtersb’ (this will throw an Error in a future version of PHP) in……
……好多好多,不忍描述。然後下面是網站正常的樣子。
以上這些錯誤大概意思是“使用了未定義的常量gallerytag、videotag、taotag、filtersa、filtersb,這将在未來的PHP版本中引發錯誤“;
我去,不是說wordpress完美支援php7麼?怎麼會這樣,細一思考,這其實不怪wordpress,而是用的是“知更鳥”主題,這個主題有很多字段模型,如上面的gallerytag、videotag等,這都是主題附帶的。
那解決方法有兩種:
一、更新主題,這個不太現實。
二、隻是報了”Warning警告“,我能不能不讓這些錯誤資訊顯示?
看來隻需要關閉”PHP錯誤提示“就行了。寶塔面闆中操作如下:
進入php管理,點“配置修改”,設定display_errors為關閉,然後儲存,重新開機一下服務。
就這麼簡單。
如果不是在寶塔面闆,那就要深入腹地,修改php.ini檔案。
1、打開 php.ini
2、設定 error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
3、設定 display_errors = Off
其實兩個方法,隻是方式不同,改的都是同一個東西。
原文位址: http://tencent.yundashi168.com/560.html