[Smarty4] 出現 modifiers 函式不能用的問題
分享完整連結 //n.sfs.tw/m10939
分享連結 [Smarty4] 出現 modifiers 函式不能用的問題@精讚(文章歡迎轉載,請尊重版權註明連結來源)
2024-06-09 02:16:28 By 張○○
當我把smarty由3版更新到4.5.1版的時候,出現了錯誤:
A PHP Error was encountered
Severity: 16384
Message: Using unregistered function "urlencode" in a template is deprecated and will be removed in a future release. Use Smarty::registerPlugin to explicitly register a custom modifier.
Filename: sysplugins/smarty_internal_compile_private_modifier.php
簡單來說,這個 urlencode是php的函式拿來作view中的 modifier (輔助修改函數)。在4版時只要把smarty物件註冊即可:
$smarty->registerPlugin("modifier", "rand", "rand");
$smarty->registerPlugin("modifier", "json_encode", "json_encode");
And the same for every modifier you need. The other option is to replace the modifier with the use of the function, so this:
{$var|substr:0:10}
To this:
{substr($var,0,10)}
相關連結
https://stackoverflow.com/questions/77170834/why-will-smarty-remove-support-for-using-php-functions-as-modifiers
[地理] 澳洲柏斯的位置竟然比台灣還要西邊
這近我驚奇的發現,澳洲柏斯的精度竟然比臺灣甚至今晚還要來的西邊
WarSpotting 統計俄國在烏克蘭戰爭中到底是損失了多少軍事裝備或人員
這個網站可以看到俄羅斯在戰場上的軍事人員裝備損失,非常詳細
Mac上 vim的複製貼上不能用
在freebsd系統中發現vim裡的command+c沒辦法選取複製,但command+v可以貼上
check-host 從世界各地檢查你的網站能不能連線?
檢測你的網站能不能暢通?這個網站可讓你知道你的網站是不是「網際網路」還是「區域網路」?
[Smarty4] 出現 modifiers 函式不能用的問題
當我把smarty由3版更新到4.5.1版的時候,出現了Using unregistered function xx in a template這樣的錯誤,該如何解決?
[Docker] docker中要怎麼修改影像的名稱,rename image
透過 build來的image如果沒有指定名稱,事後要怎麼修改影像的名稱?