打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
php5.5上部署ecshop出现的问题
直接上代码:
    问题:Warning: preg_replace_callback(): Modifier /e cannot be used with replacement callback in E:\Program Files\xampps\htdocs\upload\includes\cls_template.php on line 1075

     我的代码是:
            /* 将模板中所有library替换为链接 */               ------(1072行)
            $pattern     = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';            ------(1073行)
            $replacement = function ($matches) { return '{include file='.strtolower($matches[1]). '}';};         ------(1074行)
            $source      = preg_replace_callback($pattern, $replacement, $source);                                      ------(1075行)


话说这个地方还是我修改过的,修改之后,本来不保存。我把后台的别的地方一修改。回来他就有报错了。我附上之前的原始代码.各位帮我看看:
     没有修改的原始代码:
     /* 将模板中所有library替换为链接 */
            $pattern     = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';
            $replacement = "'{include file='.strtolower('\\1'). '}'";
            $source      = preg_replace($pattern, $replacement, $source);

$pattern     = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/se';  ???
去掉那个 e !!!
正因为 php5.5 不能有那个 e 才需要修改的
你还留着那个 e,不出错才怪呢

$out = "<?php \n" . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
这个怎么改? 

$out = "<?php \n" . '$k = ' . preg_replace_callback("/(\'\\$[^,]+)/" , function($ro) use ($t) { return stripslashes(trim($ro[1],'\''));}, var_export($t, true)) . ";\n";  


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
如何在PHP中使用正则表达式进行查找替换
ECSHOP报错误Deprecated: preg_replace(): The /e modifier is depr
Deprecated: Function ereg
PHP 7.0.0中ereg_replace 函数使用preg_replace替换方法
带着项目学PHP第八讲
preg_replace_callback
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服