1. 程式人生 > >解決DEDECMS Call to undefined function dede_htmlspecialchars()錯誤

解決DEDECMS Call to undefined function dede_htmlspecialchars()錯誤

2015年6月18日更新的新版本的織夢5.7,為了相容php5.4+,修改了/include/common.func.php,可能有些模板也改動過這個檔案,這樣會導致在安裝模板時,/include/common.func.php檔案被覆蓋,從而在釋出文章時、開啟檔案管理器對檔案進行編輯時、增加自定義表單時等,會出現“Call to undefined function dede_htmlspecialchars()”這樣的錯誤提示。
解決辦法如下:
開啟/include/common.func.php,搜尋“function RunApp”,在這個函式的上面新增織夢新版本新增的函式:dede_htmlspecialchars,具體程式碼如下:

PHP
1 2 3 4 5 6 functiondede_htmlspecialchars($str){ global$cfg_soft_lang; if(version_compare(PHP_VERSION,'5.4.0','<'))returnhtmlspecialchars($str); if($cfg_soft_lang=='gb2312')returnhtmlspecialchars($str,ENT_COMPAT,'ISO-8859-1'); elsereturnhtmlspecialchars($str); }

Good luck!