PHP递归方法

public function catSort($arr,$pid=0,$lev=0) {

        foreach($arr as $v) {

            if($v['parent_id'] == $pid) {

                $v['lev'] = $lev;

                $this->cateList[] = $v;

                $this->catSort($arr,$v['cat_id'],$lev+1);

            }

        }

    }

posted @ 2018-12-17 09:46  Ares0023  阅读(150)  评论(0编辑  收藏  举报