gongzhonghao.png
扫码关注我们
最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

记CI框架2.0购物车类的3个坑

来源:http://erdangjiade.com/topic/1608.html 你好,世界。 2017-09-25 22:42浏览(12)

CI框架,全名CodeIgniter,相信大家都不陌生,她是一个小巧的php框架,CI中国官方网站文档也很全面,现在ci4.0也出来了,加入了命名空间。

不过我个人还是比较喜欢它的2.0版本。

后期版本已经废弃了购物车功能,但对于正在使用ci2.0同学们来说,我总结出购物车类的几个bug,

代码如下:

1.对产品名称的判断规则对中文不友好。经常导致添加失败。

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



2.数量不变时,无法修改购物车信息

if ($this->_cart_contents[$items['rowid']]['qty'] == $items['qty'])
{
    //return FALSE;
}



3.只能修改数量,无法修改附加选项options
修改options附加选项

$this->_cart_contents[$items['rowid']]['qty'] = $items['qty'];
$this->_cart_contents[$items['rowid']]['options'] = $items['options'];//here new?

本文由二当家的素材网提供,

原文地址:http://www.erdangjiade.com/php-weizijiaocheng-374137.html

请勿转载~~~~

以上就是记CI2.0购物车类的3个坑的详细内容,更多请关注二当家的素材网其它相关文章!

评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2