public function getTree($parent_id=0 , $lev=1) {
$tree = array();
foreach($this->cats as $v) {
if($v['parent_id'] == $parent_id) {
$v['lev'] = $lev;
$tree[] = $v;
$tree = array_merge($tree , $this->getTree($v['cat_id'] , $lev+1) );
}
}
return $tree;
}
无限级分类范例
最新推荐文章于 2022-08-06 14:37:25 发布