已知数组Array
(
[0] => Array
(
[id] => 9
[cid] => 1
[parentid] => 0
[label] => 首页
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-9
) [1] => Array
(
[id] => 4
[cid] => 1
[parentid] => 0
[label] => 产品服务
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-4
) [2] => Array
(
[id] => 5
[cid] => 1
[parentid] => 0
[label] => 解决方案
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-5
) [3] => Array
(
[id] => 6
[cid] => 1
[parentid] => 0
[label] => 客户案例
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-6
) [4] => Array
(
[id] => 7
[cid] => 1
[parentid] => 0
[label] => 关于我们
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-7
) [5] => Array
(
[id] => 8
[cid] => 1
[parentid] => 4
[label] => 产品服务
[target] =>
[href] => home
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-4-8
))
怎么把parentid和键相同的取出放到键为parentid的里面就是说最后面那个产品服务是上面那个产品服务的子菜单
怎么遍历输出的时候在它下面而不是一下输出六个
(
[0] => Array
(
[id] => 9
[cid] => 1
[parentid] => 0
[label] => 首页
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-9
) [1] => Array
(
[id] => 4
[cid] => 1
[parentid] => 0
[label] => 产品服务
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-4
) [2] => Array
(
[id] => 5
[cid] => 1
[parentid] => 0
[label] => 解决方案
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-5
) [3] => Array
(
[id] => 6
[cid] => 1
[parentid] => 0
[label] => 客户案例
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-6
) [4] => Array
(
[id] => 7
[cid] => 1
[parentid] => 0
[label] => 关于我们
[target] =>
[href] =>
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-7
) [5] => Array
(
[id] => 8
[cid] => 1
[parentid] => 4
[label] => 产品服务
[target] =>
[href] => home
[icon] =>
[status] => 1
[listorder] => 0
[path] => 0-4-8
))
怎么把parentid和键相同的取出放到键为parentid的里面就是说最后面那个产品服务是上面那个产品服务的子菜单
怎么遍历输出的时候在它下面而不是一下输出六个
if($i['parentid'] == $key){
//你的代码
}
}