php实现无限极分类
作者:互联网
1、无限极分类
//处理父子级 private function getChildBak($data,$parent_id = 0){ $arr=array(); $i = 0; foreach($data as $val){ if($val['pId']==$parent_id){ $val['label'] = $val['name']; $arr[$i]=$val; $son=$this->getChildBak($data,$val['id']); $arr[$i]['children']=$son; $i++; } } return $arr; }
标签:arr,getChildBak,val,分类,son,无限极,php,data,id 来源: https://www.cnblogs.com/hualingyun/p/16364375.html