if (!function_exists('get_tree_list')) {
function get_tree_list($list)
{
//将每条数据中的id值作为其下标
$temp = [];
foreach ($list as $v) {
$v['son'] = [];
$temp[$v['id']] = $v;
}
//获取分类树
foreach ($temp as $k => $v) {
$temp[$v['pid']]['son'][] =& $temp[$v['id']];
}
return isset($temp[0]['son']) ? $temp[0]['son'] : [];
}
}
10-25
2690
02-18
551
12-11
1457
02-23
484