ThinkPHP3.2.3中,查询语句中in的使用方法。

//删除分类
public function del(){
$cid = I('get.cid');
$cate = M('category')->field('cid,pid')->select();
$cate = $this->son_cate($cate,$cid);
$cate[] = $cid;//$cate为一个数组
$where['cid'] = array('in',$cate);//cid在这个数组中,
M('category')->where($where)->delete();//$where作为条件传进来
$this->success('分类删除成功');
}

 

posted @ 2016-10-07 22:03  Yxh_blogs  阅读(34069)  评论(0编辑  收藏  举报