时间:2021-07-01 10:21:17 帮助过:24人阅读
public function get_tree_1(array $list = array())
{
$root = array();
$node = array();
foreach ($list as $k => $v) {
list($id, $pid, $name, $path) = array_values($v);
$node[$id] = $v;
if(isset($node[$pid])) {
$node[$pid]['child'][$id] = &$node[$id];
}
if($pid == 0) {
$root[$id] = &$node[$id];
}
}
return $root;
}