关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

Ecshop商城系统 在Windows的IIS上运行报错解决方案

发布时间:2020-12-18 15:00:18
Ecshop商城系统  在Windows的IIS上运行报错解决方案
wed.donfig 配置文件
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.webServer>  <rewrite>      <rules>            <rule name="Index" stopProcessing="true">          <match url="^index.html" />          <action type="Rewrite" url="index.php" />        </rule>        <rule name="Feed-C" stopProcessing="true">          <match url="^feed-c([0-9]+).xml" />          <action type="Rewrite" url="feed.php?cat={R:1}" />        </rule>        <rule name="Feed-B" stopProcessing="true">          <match url="^feed-b([0-9]+).xml" />          <action type="Rewrite" url="feed.php?brand={R:1}" />        </rule>        <rule name="Feed" stopProcessing="true">          <match url="^feed.xml" />          <action type="Rewrite" url="feed.php" />        </rule> <rule name="Goods" stopProcessing="true">          <match url="^goods-([0-9]+).html" />          <action type="Rewrite" url="goods.php?id={R:1}" />        </rule>        <rule name="Category" stopProcessing="true">          <match url="^category-([0-9]+)-b([0-9]+).html" />          <action type="Rewrite" url="category.php?id={R:1}&brand={R:2}" />        </rule> <rule name="Affiche" stopProcessing="true">          <match url="^affiche-([0-9]+)-b([0-9]+).html" />          <action type="Rewrite" url="affiche.php?ad_id={R:1}&uri={R:2}" />        </rule>      </rules>    </rewrite> </system.webServer> </configuration>
ECSHOP如何解决DEPRECATED: PREG_REPLACE()报错
类似这样的报错:
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
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
$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
$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'; $replacement = "'{include file='.strtolower('\\1'). '}'"; $source= preg_replace_callback($pattern, function ($matcher) { return '{include file=' . strtolower($matcher[1]). '}'; },$source);
四、将cls_template.php
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
替换成
$val = preg_replace_callback("/\[([^\[\]]*)\]/is",function ($matches) {return '.'.str_replace('$','\$',$matches[1]);},$val);
五、将lib_main.php
$ext = end(explode('.', $tmp));
替换成
$myarr=explode(".",$tmp); $end=end($myarr); $ext=strtolower($end);



/template/Home/Zkeys/PC/Static