我有一个这样的数组:
Array
(
[0] => stdClass Object
(
[ID] => 1
[menu_item_parent] => 0
[title] => Home
[url] => http://www.example.com/
)
[1] => stdClass Object
(
[ID] => 2
[menu_item_parent] => 0
[title] => Menu 2
[url] => http://www.example.com/menu-2/
)
[2] => stdClass Object
(
[ID] => 3
[menu_item_parent] => 2
[title] => Sub Menu 1
[url] => http://www.example.com/menu-2/sub-menu-1
[target] =>
)
[3] => stdClass Object
(
[ID] => 4
[menu_item_parent] => 0
[title] => Menu 4
[url] => http://www.example.com/menu-4/
[target] =>
)
)
现在您可以看到数组的第三项是第二个数组项的子项(请参见列menu_item_parent
)。现在我的问题是如何使用此数组显示此父项及其子项。请帮助。