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

时间:2016-10-07 23:09:02   收藏:0   阅读:2116
//删除分类
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(‘分类删除成功‘);
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!