Solution to Deprecated: preg_replace() error in ECSHOP
This article explains how ECSHOP can perfectly solve the problem of Deprecated: preg_replace() error. Share it with everyone and give it as a reference. I hope to be helpful.
With the update of the PHP version, new errors broke out in the ECSHOP system. ECSHOP official updates are too slow, and they do not upgrade in time after discovering these problems, causing users to be full of errors during installation and use. After talking for a long time, what is this new error? Its complete error message is as follows:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in... ..
Note: Not everyone’s ECSHOP will report this error. Only ECSHOP using the PHP5.5 environment will report this error.
The following ecshop development center (www.68ecshop.com) tutorial will first talk about the reasons for the error:
1), error reason:
The modifier /e used in the preg_replace() function has been deprecated in PHP5.5.x.
If your PHP version happens to be PHP5.5.X, then your ECSHOP will definitely 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, from the error message just now We can also see something, it prompts us to use preg_replace_callback instead of preg_replace.
So the solution is as follows:
Use Notepad or other PHP editing software (such as: editplus) to open the file includes/cls_template.php and find
return preg_replace("/ {([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
replaced with
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $ source);
Problem solved.
3), If other files in your ECSHOP also report similar preg_replace errors, please refer to the above method to solve it. The solution ideas and solutions are the same. .
Related recommendations:
PHP Tutorial—Ecshop Secondary Development (3)
Use ecshop to add fields to the backend goods table
Recommend 5 ecshop templates that imitate well-known e-commerce websites (collection)
The above is the detailed content of Solution to Deprecated: preg_replace() error in ECSHOP. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHPDeprecated: Functionsplit()isdeprecated-Solution When developing with PHP, we may encounter the following warning message: PHPDeprecated: Functionsplit()isdeprecated. What this warning means is that the split() function has been deprecated and its use is no longer recommended in the latest PHP versions. This article will explore this problem and provide solutions

ecshop is a "B2C" architecture; ecshop is a B2C independent online store system, suitable for enterprises and individuals to quickly build personalized online stores; the system is a cross-platform open source program developed based on PHP language and MYSQL database architecture.

MySQL is a commonly used relational database management system that provides a variety of functions to process and operate data. Among them, the REPLACE function is used to replace the specified part of the string. In this article, we will introduce how to use the REPLACE function for string replacement in MySQL and demonstrate its usage through code examples. First, let’s take a look at the syntax of the REPLACE function: REPLACE(str,search_str,replace_str).

How to sort ecshop articles: 1. Sort by publication time, you can control the order of articles in the list by modifying the publication time of the article; 2. Sort by clicks, you can achieve this sorting by installing the "Article Click Ranking" plug-in Function, this plug-in can count the number of clicks on articles; 3. Sort by the number of comments, you can implement this sorting function by installing the "Article Comment Ranking" plug-in, which can count the number of comments on articles; 4. Sort by relevance, This sorting function can be achieved by installing the "Search Ranking" plug-in.

What are the string search and replace techniques in Python? (Specific code example) In Python, strings are a common data type, and we often encounter string search and replace operations in daily programming. This article will introduce some common string search and replacement techniques, accompanied by specific code examples. To find a specific substring in a string, you can use the find() method or index() method of the string. The find() method returns the index of the first occurrence of the substring in the string.

PHPDeprecated: Functioneregi()isdeprecated-Solution As the PHP version is updated and iterated, some old functions are gradually deprecated, including function eregi(). This is a PHPDeprecated warning, meaning that using the eregi() function may cause problems in future versions. This article explains how to solve this problem and gives corresponding code examples. eregi() function

During the development process using PHP, you may encounter the following prompt message: PHPDeprecated: Methodswiththesamename, and this prompt message often confuses program developers. So, what caused this problem? How to solve it? First, let's explain what this prompt message means. Deprecated, that is, "deprecated", refers to a function or method that is obsolete and is no longer an update in future versions of PHP.

Ecshop Product Management Advanced: Learn how to add fields, you need specific code examples. When using Ecshop for product management, you often encounter situations where you need to add some custom fields to meet specific needs. By adding fields, more precise product management and better user experience can be achieved. This article will introduce how to add fields in Ecshop and provide specific code examples. First, we need to clarify the need to add fields. For example, we need to add a "production date" field to the product details page to
