用户的浏览商品记录功能代码
来源:互联网 发布:电商推荐算法 编辑:程序博客网 时间:2024/05/17 13:45
用户的浏览商品记录功能代码
- /**
- * 车辆历史浏览记录
- * $data 车辆记录信息
- */
- protected function _history($data)
- {
- if(!$data || !is_array($data))
- {
- return false;
- }
- //判断cookie类里面是否有浏览记录
- if($_COOKIE['history_car'])
- {
- $history = unserialize($_COOKIE['history_car']);
- array_unshift($history, $data); //在浏览记录顶部加入
- /* 去除重复记录 */
- $rows = array();
- foreach ($history as $v)
- {
- if(in_array($v, $rows))
- {
- continue;
- }
- $rows[] = $v;
- }
- /* 如果记录数量多余5则去除 */
- while (count($rows) > 5)
- {
- array_pop($rows); //弹出
- }
- setcookie('history_car',serialize($rows),time()+3600*24*30,'/');
- }
- else
- {
- $history = serialize(array($data));
- setcookie('history_car',$history,time()+3600*24*30,'/');
- }
- }
阅读全文
0 0
- 用户的浏览商品记录功能代码
- 记录用户的商品浏览记录(Linkedlist,删除cookie)
- cookie技术案例-用户浏览商品的记录
- 使用Cookie实现商品的浏览记录功能
- 利用Cookie实现用户浏览商品记录
- 记录浏览过的商品
- 记录浏览过的商品
- “购买过该商品的用户还浏览了”的商品推荐功能实现
- 使用cookie+工具类实现的 记录显示 用户【浏览商品记录】
- 显示用户上次浏览过的商品
- 利用cookie显示商品的浏览记录
- cookie实现商品浏览记录的原理
- 案例:商品浏览记录的实现
- 商品浏览记录的实现总体介绍
- zen cart如何实现记录当前用户浏览过的商品
- cookie商品浏览记录
- 商品浏览记录实现
- 用php实现类似淘宝,拍拍,易趣的最近浏览商品的功能模型代码
- java获取线程的返回值
- spring学习笔记叁——spring的bean注解
- POJ-3687 Labeling Balls
- IntelliJ IDEA 提交代码到 GitHub
- 智能指针
- 用户的浏览商品记录功能代码
- Python 爬虫实战案例 : 微信公众号的爬取
- android之自定义简单不平凡的对话框
- Spring Cloud与Spring Boot微服务实战
- TensorFlow:ImportError: libcudnn.so.*: cannot open shared object file: No such file or dictionary
- PAT 1072. 开学寄语
- 正则grep,sed,awk
- Least Common Multiple
- c++stl之string