//关联数组tree
function genTree5($items) {
foreach ($items as $item){
$items[$item['pid']]['son'][$item['id']] = &$items[$item['id']];
}
return isset($items[0]['son']) ? $items[0]['son'] : array();
}
//索引数组tree
function genTree6($items) {
foreach ($items as $item){
$items[$item['pid']]['son'][] = &$items[$item['id']];
}
return isset($items[0]['son']) ? $items[0]['son'] : array();
}
转载于:https://my.oschina.net/u/3103453/blog/896908