1 function fenlei($data,$pid=0,$level=0){ 2 static $arr=[]; 3 foreach($data as $k=>$v){ 4 if($v[‘pid‘]==$pid){ 5 $arr[]=$v; 6 fenlei($data,$v[‘id‘],$level+1); 7 } 8 } 9 return $arr[]; 10 }
无限级分类
原文:http://www.cnblogs.com/gjKai/p/6710369.html