时间:2021-07-01 10:21:17 帮助过:24人阅读
/** * 无限递归 * @param $data * @param $pId * @return array * @author 郑景强 */function getTree($data, $pId = 0){ $tree = array(); foreach($data as $k => $v){ if($v['pid'] == $pId){ //父亲找到儿子 $v['children'] = getTree($data, $v['id']); $tree[] = $v; //unset($data[$k]); } } return $tree;}
thinkPHP3.2递归
thinkPHP3.2递归
thinkPHP3.2递归
大大,这是什么意思