$arr=[
0 =>[
"id" =>"2",
"cate_name" =>"外用",
"parent_id" => "0",
"child" => [
0 => [
"id" => "5",
"cate_name" => "外1",
"parent_id" =>"2",
"child" =>[
0 => [
"id" =>"7",
"cate_name" => "外外1",
"parent_id" => "5",
"child" => NULL
]
]
],
1=>[
"id" => "6",
"cate_name" => "外2",
"parent_id" => "2",
"child" => NULL,
]
]
],
1 => [
"id" => "3",
"cate_name" =>"内用",
"parent_id" => "0",
"child" => NULL,
]
]
将这个三维数组分类树,组合成这种一维数组
$arr=[
0=>["id" =>"2","cate_name" =>"外用","parent_id" => "0",], //顶级分类
1=>["id" => "5","cate_name" => "外1","parent_id" =>"2",], //二级分类
2=>["id" =>"7","cate_name" => "外外1","parent_id" => "5",], //三级分类
3=>["id" => "6","cate_name" => "外2","parent_id" => "2",], //二级分类
4=>["id" => "3","cate_name" =>"内用","parent_id" => "0",],//顶级分类
];
求大神们帮忙。
紫衣仙女
斯蒂芬大帝