php 5.5 preg replace,解决ecshop在php5.5以上环境preg_replace报错方法
主要集中在 upload/includes/cls_template.php 文件中:
1:line 300 :
原语句:
return preg_replace(“/{([^\}\{\n]*)}/e”, “\$this->select(‘\\1’);”, $source);
修改为:
return preg_replace_callback(“/{([^\}\{\n]*)}/”, function($r) { return $this->select($r[1]); }, $source);
2:line 495:
原语句:
$out = “<?php \n” . ‘$k = ‘ . preg_replace(“/(\’\\$[^,]+)/e” , “stripslashes(trim(‘\\1’,’\”));”, var_export($t, true)) . “;\n”;
修改为:
PHP
$replacement = preg_replace_callback("/(\'\\$[^,]+)/" ,
function($matcher){
return stripslashes(trim($matcher[1],'\''));
},
var_export($t, true));
$out = "<?php \n" . '$k = ' . $replacement . ";\n";
1
2
3
4
5
6
$replacement=preg_replace_callback("/(\'\\$[^,]+)/",
function($matcher){
returnstripslashes(trim($matcher[1],'\''));
},
var_export($t,true));
$out="<?php \n".'$k = '.$replacement.";\n";
3:line 554:
原语句:
$val = preg_replace(“/\[([^\[\]]*)\]/eis”, “‘.’.str_replace(‘$’,’\$’,’\\1′)”, $val);
修改为:
$val = preg_replace_callback(“/\[([^\[\]]*)\]/is”,
function ($matcher) {
return ‘.’.str_replace(‘$’,’\$’,$matcher[1]);
},
$val);
4:line 1071:
PHP
//原句
$pattern = '/.*?/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
//修改为
$pattern = '/.*?/s';
$replacement = function($r){return '{include file='.strtolower($r[1]). '}';};
$source = preg_replace_callback($pattern, $replacement, $source);
1
2
3
4
5
6
7
8
//原句
$pattern='/.*?/se';
$replacement="'{include file='.strtolower('\\1'). '}'";
$source=preg_replace($pattern,$replacement,$source);
//修改为
$pattern='/.*?/s';
$replacement=function($r){return'{include file='.strtolower($r[1]).'}';};
$source=preg_replace_callback($pattern,$replacement,$source);
php 5.5 preg replace,解决ecshop在php5.5以上环境preg_replace报错方法相关推荐
- 解决使用requests_html模块,html.render()下载chromium报错、速度慢问题
解决使用requests_html模块,html.render()下载chromium报错.速度慢问题 参考文章: (1)解决使用requests_html模块,html.render()下载chro ...
- 解决vs2015使用fopen、fprintf等函数报错的问题
解决vs2015使用fopen.fprintf等函数报错的问题 参考文章: (1)解决vs2015使用fopen.fprintf等函数报错的问题 (2)https://www.cnblogs.com/ ...
- 解决使用mybatis分页插件PageHelper的一个报错问题
解决使用mybatis分页插件PageHelper的一个报错问题 参考文章: (1)解决使用mybatis分页插件PageHelper的一个报错问题 (2)https://www.cnblogs.co ...
- php 正则报错,PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析...
本文实例讲述了PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法.分享给大家供大家参考,具体如下: 环境错误级别:error ...
- 解决Windows下运行php Composer出现SSL报错的问题
解决Windows下运行php Composer出现SSL报错的问题 2015-01-14 20:05 在windows下运行composer却出现SSL报错: E:\www>php -f co ...
- springboot导入项目依赖报错_如何解决spring boot 项目导入依赖后代码报错问题
如何解决spring boot 项目导入依赖后代码报错问题 2020-08-15 14:17:18 代码截图如图所示(由于本人问题已经解决,没来得及截图,所以在网上找了一张图片) 针对图中所示的 ...
- 解决“(1146, “Table ‘mydb.django_session‘ doesn‘t exist“)”报错的方法
解决"(1146, "Table 'mydb.django_session' doesn't exist")"报错的方法 参考文章: (1)解决"(1 ...
- 解决CPLEX安装后无法运行代码,报错乱码(错误显示:ÔËÐÐÅäÖá°配置 1¡±²»´æÔڡ£)
解决CPLEX安装后无法运行代码,报错乱码(错误显示:ÔËÐÐÅäÖá°配置 1¡±²»´æÔڡ£) CPLEX错误显示如下: 解决方法: 重命名"配置 1"为"Conf ...
- Ubuntu环境QT报错:-1 error: cannot find -lGL(解决99%)
Ubuntu环境QT报错:-1 error: cannot find -lGL(解决99%) 本文参考:http://c.biancheng.net/view/3901.html 在Ubuntu18. ...
- 解决Docker添加Docker官方的GPG密钥报错gpg: can‘t open ‘–‘: No such file or directory
解决Docker添加Docker官方的GPG密钥报错gpg: can't open '–': No such file or directory ubuntu下载安装docker添加Docker官方的 ...
最新文章
- 3D曲面重建之移动最小二乘法
- cenos7 阿里云数据库扩容步骤
- 成功解决raise XGBoostError(_LIB.XGBGetLastError()) xgboost.core.XGBoostError: b'[22:08:00] C:\\Users\\Ad
- 将Datatable一分为二
- 快速排序(Quick_Sort)
- 闪灯什么意思_车灯闪1下、2下、3下各代表什么意思?关键时刻可以保命
- 杭州高职单招计算机试题,河北省高职单招职业技能练习题20
- Unexpected end of JSON input while parsing near错误解决方式(网上的方法)
- Java性能优化方面的程序优化知识点归纳,希望对你有所帮助
- poj 1905Expanding Rods
- ubuntu networking 与 network-manager
- 全新第二代至强,凌动 P5900……英特尔四款 5G 新利器开启 2020 开门红!
- python3.7 keras和tensorflow兼容_解决Keras 与 Tensorflow 版本之间的兼容性问题
- free 和 fclose
- 中国住户收入调查(CHIP)数据及问卷(1988-2008年)
- 宝塔 无法自动认证,请填写本地服务器的登录信息
- Redis5.0集群搭建(三主三从)、添加一主一从、JedisCluster连接集群
- 基于Echarts实现可视化数据大屏物流云大数据看板页面HTML模板
- png图片尺寸大小调整
- 将【axmol】引擎的OpenAL实现在iOS平台替换openal-soft详细过程