对前台传来的商品id数组在表中进行查询
//$goods = array(11,10,7);
$where['goods_id']=array("in",$goods);
$where['user_id'] = $_SESSION['uid'];
$res = D("cart")->where($where)->select();
复制代码
得到sql语句如下
"SELECT * FROM `cart` WHERE `goods_id` IN (11,10,7) AND `user_id` = 1