标签:== evel eve for fun return merge 递归 turn
function getSubs($categorys,$catId=0,$level=1)
{
$subs = array();
foreach ($categorys as $item) {
if ($item[‘parentId‘] == $catId) {
$item[‘level‘] = $level;
$subs[] = $item;
$subs = array_merge($subs, getSubs($categorys, $item[‘categoryId‘], $level + 1));
}
}
return $subs;
}
标签:== evel eve for fun return merge 递归 turn
原文地址:https://www.cnblogs.com/qiaochaoyu/p/13853701.html