The following small series will bring you an ECSHOP perfect solution for Deprecated: preg_replace () errors. I think it is quite good. now I will share it with you and give you a reference. Let's take a look at it. with the popularity of PHP5.5, the ECSHOP system has encountered new errors. PHP has undergone many minor changes since its development to PHP5.5. The official updates of ECSHOP are too slow. if these problems are detected, they are not upgraded in time, resulting in hundreds of errors during installation and use. After talking about this new error for a long time, the complete error message is as follows:
Deprecated: preg_replace (): The/e modifier is deprecated, use preg_replace_callback instead in .......
Note: This error is reported only when ECSHOP in PHP5.5 environment is used.
The following ecshop Development Center (www.68ecshop.com) tutorial first describes the cause of the error:
1) cause of error:
The modifier/e used in the preg_replace () function has been discarded in PHP5.5.x.
If your PHP version happens to be PHP5.5.X, your ECSHOP will certainly report an error similar to the following:
Deprecated: preg_replace (): The/e modifier is deprecated, use preg_replace_callback instead in ......
2) solution:
In fact, we can also see from the error message just now that we use preg_replace_callback to replace preg_replace.
The solution is as follows:
Use Notepad or other PHP editing software (such as editplus) to open the file des/cls_template.php and find
Return preg_replace ("/{([^ \} \ {\ n] *)}/e", "\ $ this-> select ('\ 1 ');", $ source );
Replace
Return preg_replace_callback ("/{([^ \} \ {\ n] *)}/", function ($ r) {return $ this-> select ($ r [1]) ;}, $ source );
Solve the problem.
3 ),If other files in your ECSHOP report a similar preg_replace error, refer to the above method to solve the problem. The solution is the same as the solution.
The above ECSHOP perfectly solves the problem of Deprecated: preg_replace () error, that is, all the content I have shared with you. I hope to give you a reference and support.