Ecshop error in php5.6. Under 5.3, it is normal. It should be a function change in PHP later versions. Error message: Deprecated: preg_replace (): Theemodifierisdeprecated, usepreg_replace_callbackinsteadinhomewwwrootwww.ufe... ecshop error in php5.6. Under 5.3, it is normal. It should be a function change in PHP later versions.
Error message:
Deprecated: preg_replace (): The/e modifier is deprecated, use preg_replace_callback instead in/home/wwwroot/www.ufeelwine.com/#des/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/#des/cls_template.php on line 483
Specific webpage address:
Http://www.ufeelwine.com/supplier.php? SuppId = 7
Row 3:
$out = "
_echash . $k[\'name\'] . \'|\' . serialize($k) . $this->_echash;' . "\n?>";
Row 3:
$pattern = '/
.*?
/se'; $replacement = "'{include file='.strtolower('\\1'). '}'"; $source = preg_replace($pattern, $replacement, $source);
How should I rewrite it?
Reply content:
Ecshop error in php5.6. Under 5.3, it is normal. It should be a function change in PHP later versions.
Error message:
Deprecated: preg_replace (): The/e modifier is deprecated, use preg_replace_callback instead in/home/wwwroot/www.ufeelwine.com/#des/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/#des/cls_template.php on line 483
Specific webpage address:
Http://www.ufeelwine.com/supplier.php? SuppId = 7
Row 3:
$out = "
_echash . $k[\'name\'] . \'|\' . serialize($k) . $this->_echash;' . "\n?>";
Row 3:
$pattern = '/
.*?
/se'; $replacement = "'{include file='.strtolower('\\1'). '}'"; $source = preg_replace($pattern, $replacement, $source);
How should I rewrite it?
// -- Original
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
// -- Modify
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
// -- Original
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
// -- Modify
$val = preg_replace_callback("/\[([^\[\]]*)\]/is", function($r) { return '.'.$r[1]; }, $val);
// -- Original
$out = "
// -- Modify
$out = "
// --- Original
$pattern = '/ .*? /se';$replacement = "'{include file='.strtolower('\\1'). '}'";$source = preg_replace($pattern, $replacement, $source);
// --- Modify
$pattern = '/ .*? /s';$replacement = function ($r) { return '{include file='.strtolower($r[1]). '}'; };$source = preg_replace_callback($pattern, $replacement, $source);
Try it. there is no environment to test. you can modify it according to the prompt.
Row 3: changed
$out = "
Row 3: changed
//$pattern = '/ .*? /se';//$replacement = "'{include file='.strtolower('\\1'). '}'";$source = preg_replace('/ .*? /se', function($r) { return '{include file='.strtolower('\\1'). '}';}, $source);
The prompt is clear.
Replace preg_replace with preg_replace_callback
Let's see the usage of preg_replace_callback.
/* 1. remove e parameter 2. replace \ 1 with the elements corresponding to the callback array * // 483 rows $ out ="