数组 字符串之间的 处理
$goods_id = (int)$goods_id; // 先从COOKIE中取出这前浏览过的商品 $goods = cookie('beforeViewGoods'); // 1,2,3,4,5 $goods = explode(',', $goods); // 把当前浏览的商品放到数组中的第一个位置上 array_unshift($goods, $goods_id); // 去重 $goods = array_unique($goods); if(count($goods) > 5) { $goods = array_splice($goods, 0, 5); } $goods = implode(',', $goods); $goods = trim($goods, ',');