有朋友可能会发现codeigniter 购物车类不能添加中文,我找了n久才发现下面一段代码限制了输入中文了,下面我来给大家介绍。
修改systemlibrariescart.php,注释第186-190行产品名称的判断:
| 代码如下 | 复制代码 |
|
/*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; 立即学习“PHP免费学习笔记(深入)”; } |
|
不过删除不是最好的办法,我们可以直接把正则匹配改成中文也可以就行了,这个我就不介绍了大家可到php教程频道去查看。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号