时间:2021-07-01 10:21:17 帮助过:19人阅读
错误提示:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/wwwroot/www.ufeelwine.com/includes/cls_template.php on line 1061
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/wwwroot/www.ufeelwine.com/includes/cls_template.php on line 483
具体网页地址:
http://www.ufeelwine.com/supplier.php?suppId=7
第483行:
$out = "_echash . $k[\'name\'] . \'|\' . serialize($k) . $this->_echash;' . "\n?>";
第1061行:
$pattern = '/.*?/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
应该怎么改写呢?
ecshop在php5.6下的错误。在5.3下是正常的。应该是PHP高版本函数变化了。
错误提示:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/wwwroot/www.ufeelwine.com/includes/cls_template.php on line 1061
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/wwwroot/www.ufeelwine.com/includes/cls_template.php on line 483
具体网页地址:
http://www.ufeelwine.com/supplier.php?suppId=7
第483行:
$out = "_echash . $k[\'name\'] . \'|\' . serialize($k) . $this->_echash;' . "\n?>";
第1061行:
$pattern = '/.*?/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
应该怎么改写呢?
//-- 原本
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
//-- 修改成
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
//-- 原本
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
//-- 修改成
$val = preg_replace_callback("/\[([^\[\]]*)\]/is", function($r) { return '.'.$r[1]; }, $val);
//-- 原本
$out = "
//-- 修改成
$out = "
//--- 原本
$pattern = '/.*?/se';
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
//--- 修改成
$pattern = '/.*?/s';
$replacement = function ($r) { return '{include file='.strtolower($r[1]). '}'; };
$source = preg_replace_callback($pattern, $replacement, $source);
试试,没有环境没办法测试,根据提示信息改的
第483行:改成
$out = "
第1061行:改成
//$pattern = '/.*?/se';
//$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace('/.*?/se', function($r) { return '{include file='.strtolower('\\1'). '}';}, $source);
提示很清楚了啊
把preg_replace换成preg_replace_callback
看看preg_replace_callback的用法就明白了
/*
1、e参数去掉
2、后面的\1换成回调的数组对应的元素
*/
//483行
$out = "