使用Smarty模板2.x注入变量报错
2016-07-11 14:39
645 查看
原因:
php5.5以后的preg_replace不再支持e模式修饰符,可以用preg_replace_callback函数替换。
解决办法:
找到文件 Smarty_Compiler.class.php 第270行:
替换为:
转载自:http://www.epooll.com/archives/791/
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/
相关文章推荐
- 一个关于if else容易迷惑的问题
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- rem : web app适配的秘密武器
- jquery高级应用之Deferred对象
- 关于浮动与清除浮动,你应该知道的
- 数组reduce方法的高级技巧
- php7 读取php.ini[4]
- PHP+Apache在Windows 9x下的安装和配置
- IIS 6 的 PHP 最佳配置方法
- 安装Apache和PHP的一些补充
- Linux Apache+MySQL+PHP
- 建立Apache+PHP+MySQL数据库驱动的动态网站