//刪除分類 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('分類刪除成功'); }