我使用过 ZF2 的 Skeleton 应用程序进行学习。现在,我正在学习导航。我有一个问题。
在 service_manager 中添加了导航类。
'Navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory'
(模块的配置文件:module.config.php)
在 nav_config.php 中有以下代码。(配置/nav_config.php)
<?php return array( 'navigation' => array( 'default' => array( 'disc' => array( 'label' => 'Album', 'route' => 'album', 'pages' => array( 'index' => array( 'label' => 'Listing', //'route' => 'album/index', 'module' => 'album', 'controller' => 'album', 'action' => 'index', ), 'add' => array( 'label' => 'Add Album', //'route' => 'album/add', 'module' => 'album', 'controller' => 'album', 'action' => 'add', ), ), ), ), ), );
在 layout.php 中,放置了这段代码。
<?php echo $this->navigation()->breadcrumbs('navigation')->setMinDepth(0)->setLinkLast(true)->render(); ?>
访问主机名/光盘时,我在面包屑中看到“专辑”文本。当我访问主机名/光盘/添加时,我再次得到相同的结果,那就是单独的“专辑”。但我想获得“专辑/添加专辑”。请指导实现。