After following, you can keep track of his dynamic information in a timely manner
Courses in the relevant section:Role addition
$children=null; foreach ($temp as $item) { //主菜單 if ($item['pid'] == 0) { $parent[] = $item; }else{ $children[]=$item; } } foreach ($children as $sub){ //所有的子菜單歸類 foreach ($parent as $key => $par){ if ($sub['pid']==$par['id']){ $parent[$key]['children'][]=$sub; } } }
2019-09-220個(gè)贊