标签:
//栏目无限极分类 public function getTree($arr,$id = 0,$lev = 0){ //存放结果数组 $tree = array(); //遍历栏目信息 foreach($arr as $v){ if($v[‘parent_id‘] == $id){ $v[‘lev‘] = $lev; $tree[] = $v; $tree = array_merge($tree,$this->getTree($arr,$v[‘cat_id‘],$lev + 1)); } } //返回结果 return $tree; }
标签:
原文地址:http://www.cnblogs.com/lesuso/p/5099049.html