Codeigniter cannot add Chinese characters to the shopping cart class. Codeigniter cannot add Chinese characters to the shopping cart class. This document describes how to add Chinese characters to the shopping cart class of codeigniter. For example, Codeigniter cannot add Chinese characters to a shopping cart.
This example describes how to add Chinese characters to the Codeigniter shopping cart class. Share it with you for your reference. The specific analysis is as follows:
Some may find that the Codeigniter shopping cart class cannot add Chinese characters. After I have been searching for N for a long time, I found that the following code restricted the input of Chinese characters and modified systemlibrariesCart. php: comment out the product name judgment in line 186-190. the code is as follows:
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, deleting a regular expression is not the best solution. you can simply change the regular expression matching to Chinese. If you are interested, you can refer to the PHP regular expression to verify Chinese.
I hope this article will help you with ThinkPHP framework programming.
Examples in this article describes how to add Chinese characters to the Codeigniter shopping cart class. I will share it with you for your reference...