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

不言
不言Original
2018-06-19 17:04:221168browse

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;  
}

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!

Statement:
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