PHP模板引擎:Smarty 2.6.0(/ includes / Smarty)正在使用不推荐的修饰符'e'进行preg_replace函数调用:
阻止导致错误:/include/Smarty/Smarty_Compiler.class.php @第262行
/* replace special blocks by "{php}" */
$source_content = preg_replace($search.'e', "'"
. $this->_quote_replace($this->left_delimiter) . 'php'
. "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
. $this->_quote_replace($this->right_delimiter)
. "'"
, $source_content);
如果您只是尝试将Smarty升级到当前版本3.1.16,或最接近的可用版本2.6.28 . 不起作用 .
这是解决方案:
所以我应用了PHP引用推荐的替代调用 . 更改:/include/Smarty/Smarty_Compiler.class.php @第262行
/* replace special blocks by "{php}" */
$source_content = preg_replace_callback($search,
function($m) {
return "{php ".str_repeat("\n", substr_count($m[0], "\n"))."}";
},
$source_content);
我希望这会帮助别人并节省他几个小时 .
1 回答
以下代码应允许其他Smarty分隔符标记与您的替换一起使用: