thinkphp递归获取所有子级

    public function getChildIds($pid){
	    $data = M('download_cate')->field('id')->where(['parent_id'=>$pid])->select();
	    $childIds = [];
	    foreach ($data as $v){
	        $childIds[] = $v['id'];
	        $childIds = array_merge($childIds, $this->getChildIds($v['id']));
	    }
	    return $childIds;
	}

你可能感兴趣的:(ThinkPHP,PHP,php)