Home > Backend Development > PHP Tutorial > How to solve the problem that the Codeigniter shopping cart class cannot add Chinese

How to solve the problem that the Codeigniter shopping cart class cannot add Chinese

不言
Release: 2023-04-01 14:52:02
Original
1160 people have browsed it

This article mainly introduces the solution to the problem that the Codeigniter shopping cart class cannot add Chinese. It involves the limitation of Chinese in the underlying code, which can be solved by modifying the regular matching rules. Friends in need can refer to the following

The example in this article describes the solution to the problem that the Codeigniter shopping cart class cannot add Chinese. Share it with everyone for your reference. The specific analysis is as follows:

Some friends may find that the Codeigniter shopping cart class cannot add Chinese. After searching for a long time, I found that the following code restricts the input of Chinese. Modify systemlibrariesCart.php and comment out lines 186-190. To judge the product name, the code is as follows:

if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name'])) 
{  
     log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces');  
     return FALSE;  
}
Copy after login

However, deletion is not the best way. We can just change the regular matching to Chinese.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Analysis on the CodeIgniter framework verification code library files and usage

The public model of the CI framework Class definition and usage

How to implement the shopping cart function based on the CodeIgniter framework

##

The above is the detailed content of How to solve the problem that the Codeigniter shopping cart class cannot add Chinese. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template