Hy everyone!zf2導航 - 'Zend ServiceManager ServiceManager :: get無法獲取或創建導航實例'
我學習ZF2,並試圖建立一個導航面板(基於:Zend Framework 2: Zend_Navigation),但是從計算機的回答仍然是:
出現錯誤 執行過程中出現的錯誤;請稍後再試。 其他信息: 的Zend \的ServiceManager \異常\ ServiceNotFoundException的 文件: /var/www/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:453 消息: 的Zend \的ServiceManager \的ServiceManager :: GET無法獲取或者導航創建一個實例
的module.config.php包含:
'servicemanager' => array(
'factories' => array(
'navigation' => function($sm) {
$config = $sm->get('Config');
$navigation = new \Zend\Navigation\Navigation($config->get('navigation'));
return $navigation;
}
),
),
我在這是主要的配置/自動加載的文件夾中的application.global.php看起來像:
<?php
return array(
// All navigation-related configuration is collected in the 'navigation' key
'navigation' => array(
// The DefaultNavigationFactory we configured in (1) uses 'default' as the sitemap key
'default' => array(
// And finally, here is where we define our page hierarchy
'Album' => array(
'label' => 'Albumlista',
'route' => 'album',
'action' => 'index',
'pages' => array(
array(
'label' => 'Add',
'route' => 'album',
'action' => 'add'
)
)
),
'Application' => array(
'label' => 'Alap alkalmazás',
'route' => 'application',
'action' => 'index',
)
),
),
);
而且從控制器我給這個命令:
$config = $this->getServiceLocator()->get('navigation');
有人能幫助我解決這個問題呢? 我讀了約http://adam.lundrigan.ca/2012/07/quick-and-dirty-zf2-zend-navigation/,我試了一下,我做了,但我想結合acl,以便我寫這個問題。
感謝您的幫助!
你能解釋一下你插入put_absolute_path_here的內容嗎? – 2015-02-12 11:27:21