使用Smarty模板2x注入变量报错

php教程评论1.3K views阅读模式

原因:

php5.5以后的preg_replace不再支持e模式修饰符,可以用preg_replace_callback函数替换。

解决办法:

找到文件 Smarty_Compiler.class.php 第270行:

/* 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);

替换为:

// 解决:preg_replace(): The /e modifier is deprecated, use preg_replace_callback ins$source_content= preg_replace_callback($search, create_function ('$matches', "return '".$this->_quote_replace($this->left_delimiter) .'php'."' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'".$this->_quote_replace($this->right_delimiter) 
                               ."';") 
                               , $source_content);

转载自:http://www.epooll.com/archives/791/

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('

  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了 使用Smarty模板2x注入变量报错,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

    企鹅博客
    • 本文由 发表于 2020年8月19日 05:46:05
    • 转载请务必保留本文链接:https://www.qieseo.com/320022.html

    发表评论