<?php function getTree($list,$pid=0,$level=0){ static $result=array(); foreach($list as $value){ if($value[‘pid‘]==$pid){ $result[]=$value; getTree($list,$value[‘id‘],$level+1); } } return $result; }
php无限极分类
原文:http://www.cnblogs.com/mengor/p/7823463.html