我有以下多维数组$array:
Array
(
[criteria] => default
[name] => default
[data] => Array
(
[0] => Array
(
[criteria] => test1
[name] => test1_name
[data] => Array
(
[0] => Array
(
[criteria] => test2
[name] => test2_name
[data] => Array
(
)
)
[1] => Array
(
[criteria] => test3
[name] => test3_name
[data] => Array
(
)
)
)
)
[1] => Array
(
[criteria] => test4
[name] => test4_name
[data] => Array
(
)
)
)
)
我需要提取每个节点的名称($array['data']) 及其之前的所有父节点的标准和标准。就像是:
Array
(
Array
(
[name] => default
[criteria] =>
array(
[0] => default
)
)
Array
(
[name] => test1
[criteria] => array
(
[0] => default
[1] => test1
)
)
Array
(
[name] => test2
[criteria] => array
(
[0] => default
[1] => test1
[2] => test2
)
)
Array
(
[name] => test3
[criteria] => array
(
[0] => default
[1] => test1
[2] => test3
)
)
Array
(
[name] => test4
[criteria] => array
(
[0] => default
[1] => test4
)
)
)
请注意,在这种情况下,每个数组的名称字段永远不会在任何地方重复名称。