Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in D:\wyh\ecshop\includes\cls_template.php on line 300

1、错误原因:
preg_replace() 函数中用到的修饰符 /e 在 PHP5.5.x
中已经被弃用了。
如果你的PHP版本恰好是PHP5.5.X,那你的ECSHOP肯定就会报类似这样的错误。

2、解决办法:

一、将 cls_template.php的300行

return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);

换成:

return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);

二、将cls_template.php的493行

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

换成:

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

三、将cls_template.php的552行

$val =
preg_replace(
"/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')",
$val);

换成:

$val =
preg_replace_callback(
"/\[([^\[\]]*)\]/", function($r)
{
return '.'.str_replace('$','$',$r[1]);}, $val);

四、将cls_template.php的1069行

$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-->/s';
$source =
preg_replace_callback(
$pattern, function($r){return '{include file='.strtolower($r[1]). '}';}, $source);

ECSHOP如何解决Deprecated: preg_replace()报错 Home / 开源程序 / ECSHOP / ECSHOP如何解决Deprecated: preg_replace()报错的更多相关文章

  1. 解压tar.gz文件报错gzip: stdin: not in gzip format解决方法

    解压tar.gz文件报错gzip: stdin: not in gzip format解决方法 在解压tar.gz文件的时候报错 1 2 3 4 5 [Sun@localhost Downloads] ...

  2. jenkins编辑报错Exception when publishing, exception message的解决办法

    jenkins编辑报错Exception when publishing, exception message的解决办法 查看目标主机的磁盘空间是否占满,清理磁盘空间即可

  3. 小程序-报错 xxx is not defined (已解决)

    小程序-报错 xxx is not defined (已解决) 问题情境: 这样一段代码,微信的小程序报错 is not defined 我 wxml 想这样调用 //wxml 代码 <view ...

  4. LR回放webservice脚本报错------------mmdrv.exe应用程序错误(未解决)

    1.录制完成webservice脚本如下: 2.回放脚本,报错: 3.网上查看了一些解决办法,但都是没有起到作用.

  5. 第一次打开pycharm运行python文件报错”No Python interpreter selected“问题的解决办法

    前面没有细讲,这里细述一下安装pycharm后,第一次打开pycharm运行python文件报错"No Python interpreter selected"问题的解决办法. 出 ...

  6. 项目报错:/uploads: Read-only file system(解决办法)

    项目报错:/uploads: Read-only file system(解决办法) 本来以为是service层没加注解,翻到最后才发现问题 原因是项目根目录没有对应的文件夹,在项目根目录创建uplo ...

  7. 解决Pyqt打包后运行报错:应用程序无法启动 因为程序的并行配置不正确

    做了一个生成二维码的小程序:http://www.cnblogs.com/dcb3688/p/4241048.html 直接运行脚本没问题,用pyinstaller打包后再运行就直接报错了: 应用程序 ...

  8. Windows 8.1升级至Windows 10后,启动VisualSVN Server Manager报错:提供程序无法执行所尝试的操作 (0x80041024)的解决

    1.1.Windows 8.1升级至Windows 10后,启动VisualSVN Server Manager报错:提供程序无法执行所尝试的操作 (0x80041024),VisualSVN Ser ...

  9. IE浏览器F12调试模式不能使用或报错以及安装程序遇到错误0x80240037的解决办法

    记录一下,方便以后查找 IE浏览器F12调试模式不能使用: 需要下载补丁: 64位系统 然后下载安装,就能解决问题. 要是在安装时遇到出现: 安装程序遇到错误 0x80240037   解决方式 最后 ...

随机推荐

  1. DG_Oracle DataGuard Primary/Standby物理主备节点安装实践(案例)

    2014-09-09 Created By BaoXinjian

  2. Form_通过Custom.pll新增菜单项(案例)

    2014-05-31 Created By BaoXinjian

  3. linux命令(4):top 命令(性能分析工具)

    linux 的top命令详解 简介 top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器. top显示系统当前的进程和其他状况,是一个 ...

  4. A note to "On global motions of a compressible barotropic and selfgravitating gas with density-dependent viscosities"

    Ducomet, Bernard; Nečasová, Šárka; Vasseur, Alexis. On global motions of a compressible barotropic a ...

  5. TNT平台

    1, TNT平台 本词条缺少信息栏.名片图,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧! TNT平台中的开发平台是基于微软Jupiter平台的快速开发工具,开发者可以通过界面属性设定的方法来 ...

  6. ylbtech-Unitity-CS:Generics

    ylbtech-Unitity-CS:Generics 1.A,效果图返回顶部 Unsorted List: Raul:35 Alessandro:30 Maria:72 Hiroyuki:108 A ...

  7. Getting started with SciPy for .NET

    Getting started with SciPy for .NET 1.) IronPython Download and install IronPython 2.7, this will re ...

  8. jQuery 常见操作实现方式

    一个优秀的 JavaScript 框架,一篇 jQuery 常用方法及函数的文章留存备忘. jQuery 常见操作实现方式 $("标签名") //取html元素 document. ...

  9. feedback 是什么意思

    feedback 是什么意思 能否不要说 feedback 呢?  加一个 feedback?  天啊   先解释一下 feedback 是什么  ? 还有   aria-describedby=&q ...

  10. windows 下使用 zip安装包安装MySQL 5.7

    以下内容参考官方文档:http://dev.mysql.com/doc/refman/5.7/en/windows-start-command-line.html 解压缩zip到D:\mysql-5. ...