标签:div == turn function tree fun func lse pid
function tree($arr, $pid=0, $level=0){ static $tree = []; foreach($arr as $v){ if($v[‘pid‘] == $pid){ $v[‘level‘] = $level; if($pid == 0){ $v[‘name‘] = $v[‘name‘]; }else{ $v[‘name‘] = str_repeat(‘ ‘, $level).‘└─‘.$v[‘name‘]; } $tree[]=$v; tree($arr, $v[‘id‘], $level+1); } } return $tree; }
标签:div == turn function tree fun func lse pid
原文地址:https://www.cnblogs.com/zjj1990/p/9274241.html