php数组通过递归转换成无限级树结构

摘要: //id作为索引,pid 为父索引 function tree(&$list,$pid=0){ $tree=[]; foreach ($list as $key=>$item){ if ($item['pid'] $pid){ $tree[$item['id']]=$item; unset($lis 阅读全文
posted @ 2022-08-01 23:48 DreamOnTheGo 阅读(55) 评论(0) 推荐(0)