安装ecshop2.7时候的错误处理 php版本不兼容引起
装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版本不兼容引起的更多相关文章
- Mint Linux 安装 DotnetCore 遭遇无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系
evlon@evlon-ThinkPad-T530 ~ $ apt install dotnet-dev-1.0.0-preview2-003121 正在读取软件包列表... 完成 正在分析软件包的依 ...
- 子进程 已安装 pre-removal 脚本 返回了错误号 1或2 与 子进程 已安装 post-installation 脚本 返回了错误号 1或2
今天在ubuntu kylin上安装了virtualbox, 后来我想删除了再装个新一点的,结果正常的情况下删除不了,我就把找到的virtualbox的目录全部都删除了, 再通过apt-get rem ...
- Windows 安装启动apache时出现错误的解决方法
配置安装Apache主服务发生错误:(OS 5)拒绝访问. : AH00369: Failed to open the Windows service manager, perhaps you fo ...
- 安装loadrunner11 ,出现如下错误如何解决?
出现的问题是: 安装LoadRunner 11时弹窗提示"Micosoft Visual C++ 2005 SP1 可再发行组件包(X86):'命令行选项语法错误.键入命令 / ? 可获得帮 ...
- 现场故障案例:AIX安装Oracle10G runInstaller弹出错误一例
AIX安装Oracle10G runInstallert弹出错误一例 环境: 系统:AIX5300-08 数据库:Oracle 10g(64bit) AIX客户机卸载oracle软件后,又一次安装or ...
- 关于pip安装时提示"pkg_resources.DistributionNotFound"错误
使用pip install --upgrade pip升级pip中途失败,再次安装pip,完成后出现如下错误: 尝试重新安装pip也不行,同样会出现上述问题. 此时我们查看/usr/bin/pip文件 ...
- hadoop安装过程中出现的错误
此次来记录一下我在安装Hadoop安装过程中出现的错误,安装过程参照慕课网林子雨教程进行安装,在尝试过程中出现的错误如下: 1.在安装Ubuntu时,新建虚拟电脑时,并没有在版本的输入框中有Ubunt ...
- Ubuntu 打包后安装提示:子进程 已安装 pre-removal 脚本 返回了错误号 1
子进程 已安装 pre-removal 脚本 返回了错误号 1或2 与 子进程 已安装 post-installation 脚本 返回了错误号 1或2 一.子进程 已安装 pre-removal ...
- 安装APK时引发INSTALL_PARSE_FAILED_MANIFEST_MALFORMED错误的几种可能(申明:来源于网络)
安装APK时引发INSTALL_PARSE_FAILED_MANIFEST_MALFORMED错误的几种可能(申明:来源于网络) 地址:https://my.oschina.net/freestyle ...
随机推荐
- 在ASP.NET MVC中使用Knockout实践08,使用foreach绑定集合
本篇体验使用 foreach 绑定一个Product集合. 首先使用构造创建一个View Model. var Product = function(data) { this.name = ko.ob ...
- iPhone开发过程中调试多次Release问题 message sent to deallocated
初级:第一步 为程序添加符号断点 malloc_error_break 方法如下. 目标效果:让程序崩溃时跳转到出错到那一行.但是往往达不到这个效果.不行就继续往下看. At times, wh ...
- C#编程(二十八)----------泛型类的功能
泛型类的功能 在创建泛型类时,还需要一些其他的C#关键字.例如,不能把null赋予泛型类型.此时,可以使用default关键字.如果泛型类型不需要object类的功能,但需要调用泛型类上的某些特定方法 ...
- java.util.Vector排序
Vector的排序: import java.util.*; class MyCompare implements Comparator //实现Comparator,定义自己的比较方法{public ...
- TextView字体,行距,html格式,超链接,最大长度的设定
颜色,大小 <!-- 设置字体的大小,推荐用sp做单位:字体颜色以#开头 --> <TextView android:id="@+id/textView1" an ...
- [转]Infobright是一个与MySQL集成的开源数据仓库
[文章作者:张宴 本文版本:v1.1 最后修改:2010.05.18 转载请注明原文链接:http://blog.zyan.cc/infobright/] Infobright是一个与MySQL集成的 ...
- Intellij IDEA打开就闪退或关闭
找到idea安装目录的bin目录,搜索vmoptions可以看到两个文件, idea.exe.vmoptions idea64.exe.vmoptions 1 这两个文件就是IDEA的一些配置文件,带 ...
- leetcode Roman Integer
class Solution { public: int romanToInt(string s) { if (s.length() < 1) return 0; map<char,int ...
- [leetcode]Subsets @ Python
原题地址:https://oj.leetcode.com/problems/subsets/ 题意:枚举所有子集. 解题思路:碰到这种问题,一律dfs. 代码: class Solution: # @ ...
- Letter Combinations of a Phone Number leetcode java
题目: Given a digit string, return all possible letter combinations that the number could represent. A ...