装ECShop2.7.3出现了一堆问题,主要是因为PHP版本过高引起的,不愿意降低版本,则只能一个个解决啦!这些问题包括:preg_replace、cls_image::gd_version、end(explode('.', $tmp))。

一、关于preg_replace

因为使用PHP5.5.x,ECShop安装完成之后出现了下面提示,特别是在cls_template.php文件中。下面就将需要替换的部分一一替换。

Deprecated: preg_replace(): The /e modifier is deprecated,use preg_replace_callback instead.

下面是需要替换内容:

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

替换为:

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

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

替换为:

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

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

替换为:

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

$source      = preg_replace($pattern, $replacement, $source);

替换为:

$pattern = '/<!--\s#BeginLibraryItem\s\"\/(.*?)\"\s-->.*?<!--\s#EndLibraryItem\s-->/s';
$source = preg_replace_callback($pattern, function($ro)
    {return '{include file='.strtolower($ro[1]). '}';}, $source);

二、关于cls_image::gd_version

将静态调用改为实例调用。

return cls_image::gd_version();

替换为:

$p = new cls_image();

return $p->gd_version();

三、关于end(explode('.', $tmp));

将连接运算拆分即可。

$ext = end(explode('.', $tmp));

替换为:

$arr = explode('.', $tmp);

    $ext = end($arr);

安装ecshop2.7时候的错误处理 php版本不兼容引起的更多相关文章

  1. Mint Linux 安装 DotnetCore 遭遇无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

    evlon@evlon-ThinkPad-T530 ~ $ apt install dotnet-dev-1.0.0-preview2-003121 正在读取软件包列表... 完成 正在分析软件包的依 ...

  2. 子进程 已安装 pre-removal 脚本 返回了错误号 1或2 与 子进程 已安装 post-installation 脚本 返回了错误号 1或2

    今天在ubuntu kylin上安装了virtualbox, 后来我想删除了再装个新一点的,结果正常的情况下删除不了,我就把找到的virtualbox的目录全部都删除了, 再通过apt-get rem ...

  3. Windows 安装启动apache时出现错误的解决方法

    配置安装Apache主服务发生错误:(OS 5)拒绝访问.  : AH00369: Failed to open the Windows service manager, perhaps you fo ...

  4. 安装loadrunner11 ,出现如下错误如何解决?

    出现的问题是: 安装LoadRunner 11时弹窗提示"Micosoft Visual C++ 2005 SP1 可再发行组件包(X86):'命令行选项语法错误.键入命令 / ? 可获得帮 ...

  5. 现场故障案例:AIX安装Oracle10G runInstaller弹出错误一例

    AIX安装Oracle10G runInstallert弹出错误一例 环境: 系统:AIX5300-08 数据库:Oracle 10g(64bit) AIX客户机卸载oracle软件后,又一次安装or ...

  6. 关于pip安装时提示"pkg_resources.DistributionNotFound"错误

    使用pip install --upgrade pip升级pip中途失败,再次安装pip,完成后出现如下错误: 尝试重新安装pip也不行,同样会出现上述问题. 此时我们查看/usr/bin/pip文件 ...

  7. hadoop安装过程中出现的错误

    此次来记录一下我在安装Hadoop安装过程中出现的错误,安装过程参照慕课网林子雨教程进行安装,在尝试过程中出现的错误如下: 1.在安装Ubuntu时,新建虚拟电脑时,并没有在版本的输入框中有Ubunt ...

  8. Ubuntu 打包后安装提示:子进程 已安装 pre-removal 脚本 返回了错误号 1

    子进程 已安装 pre-removal 脚本 返回了错误号 1或2 与 子进程 已安装 post-installation 脚本 返回了错误号 1或2   一.子进程 已安装 pre-removal  ...

  9. 安装APK时引发INSTALL_PARSE_FAILED_MANIFEST_MALFORMED错误的几种可能(申明:来源于网络)

    安装APK时引发INSTALL_PARSE_FAILED_MANIFEST_MALFORMED错误的几种可能(申明:来源于网络) 地址:https://my.oschina.net/freestyle ...

随机推荐

  1. 【Go入门教程3】基本类型 和 高级类型

    基本类型 Go 有很多预定义类型,这里简单地把它们分为 基本类型 和 高级类型.Go 的基本类型并不多,而且大部分都与整数相关,如下表所示: 名 称 宽度(字节) 零 值 说 明 bool 1 fal ...

  2. 【Go命令教程】4. go get

    hc@ubt:~$ go get github.com/hyper-carrot/go_lib/logging 命令 go get 可以根据要求和实际情况从互联网上下载或更新指定的代码包及其依赖包,并 ...

  3. [转载]vs2017与docker

    基本需求 系统 win10 vs2017 docker 步骤 1.开启系统的hyper-v 2. 重启电脑 3.安装docker 下载地址:https://docs.docker.com/docker ...

  4. Complete uninstall on Mac, HELP!

    Remove these directories: /Applications/Xamarin Studio.app /Developer/MonoTouch /Developer/MonoAndro ...

  5. java根据模板HTML动态生成PDF

    原文:https://segmentfault.com/a/1190000009160184 一.需求说明:根据业务需要,需要在服务器端生成可动态配置的PDF文档,方便数据可视化查看. 二.解决方案: ...

  6. [开源]Google code Android开源项目(一)

    [Android分享] [开源]Google code Android开源项目(一) [复制链接]     449122717 2 主题 2 好友 816 积分 No.4 中级开发者 升级  19.3 ...

  7. ibatis.net:尽可能的使用匿名类型替换 Hashtable

    一切尽在代码中 Hashtable 风格 public Account GetByCustomIdAndAccountType(int customId, AccountType accountTyp ...

  8. Spring Websocket实现文本、图片、声音、文件下载及推送、接收及显示(集群模式)

    相关环境 Nginx,Spring5.x当前(要选择4.0+),tomcat8.x,Quartz 2.x集群(实际运用是Quartz的集群模式和单机模式共存的) 测试面页:http://sms.rey ...

  9. 解决Installation error: INSTALL_FAILED_VERSION_DOWNGRADE错误

    Installation error: INSTALL_FAILED_VERSION_DOWNGRADE 说明你手机里已经装的软件版本比你要安装的软件版本要高,所以不能安装. 你只要删除你安装的应用便 ...

  10. 关于Spring-Data-Jpa的一些理解

    spring data jpa介绍 首先了解JPA是什么? JPA(Java Persistence API)是Sun官方提出的Java持久化规范.它为Java开发人员提供了一种对象/关联映射工具来管 ...