递归根据父ID 找所有子类ID

function getinfo($pid){
    $str = '';
    $row = M('user')->where(array('pid'=>$pid))->select();
    if($row){
        foreach($row as $key => $val ){
            $str .= ','.$val['id'];
            $str .= getinfo($val['id']);
        }
    }
    return $str;
}

 

posted @ 2016-03-27 22:47  FinnYY  阅读(171)  评论(0编辑  收藏  举报