我想构建一个自定义菜单输出,所以我调用这个类:
$pages = \Ip\Menu\Helper::getMenuItems('menu1');
它返回这个:
Array
(
[0] => Ip\Menu\Item Object
(
[title:protected] => Home
[pageTitle:protected] =>
[url:protected] => http://porto.gigaweb.me/home
[target:protected] =>
[selected:protected] =>
[current:protected] => 1
[children:protected] => Array
(
[0] => Ip\Menu\Item Object
(
[title:protected] => Lorem ipsum
[pageTitle:protected] =>
[url:protected] => http://porto.gigaweb.me/lorem-ipsumy
[target:protected] =>
[selected:protected] =>
[current:protected] =>
[children:protected] =>
[depth:protected] => 2
[disabled:protected] => 0
[blank:protected] => 0
)
[1] => Ip\Menu\Item Object
(
[title:protected] => about
[pageTitle:protected] =>
[url:protected] => http://porto.gigaweb.me/about
[target:protected] =>
[selected:protected] =>
[current:protected] =>
[children:protected] =>
[depth:protected] => 2
[disabled:protected] => 0
[blank:protected] => 0
)
)
[depth:protected] => 1
[disabled:protected] => 0
[blank:protected] => 0
)
)
我试图把它变成一个数组,但它返回像这样的值 [*title]。我想遍历它并输出值,但似乎做不到。