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; }
原创文章,作者:kirin,如若转载,请注明出处:https://blog.ytso.com/272670.html