Php ZF3导航“;插件";错误
接下来,我尝试为我的应用程序创建一个导航。我注册了一个导航,我将DefaultNavigationFactory添加到服务管理器中,但是我在尝试打印导航时出错 这是我的module/Application/config/module.config.php:Php ZF3导航“;插件";错误,php,zend-framework3,zend-navigation,Php,Zend Framework3,Zend Navigation,接下来,我尝试为我的应用程序创建一个导航。我注册了一个导航,我将DefaultNavigationFactory添加到服务管理器中,但是我在尝试打印导航时出错 这是我的module/Application/config/module.config.php: namespace Application; use Zend\Navigation\Service\DefaultNavigationFactory; use Zend\ServiceManager\Factory\InvokableFa
namespace Application;
use Zend\Navigation\Service\DefaultNavigationFactory;
use Zend\ServiceManager\Factory\InvokableFactory;
use Zend\View\Helper\Navigation;
return [
'navigation' => [
'default' => [
/* ... */
]
] ,
'service_manager' => [
'factories' => [
'navigation' => DefaultNavigationFactory::class,
],
],
];
但是当$this->navigation('default')->menu()时,我得到了这个错误,不包括堆栈跟踪:
Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: A plugin by the name "navigation" was not found in the plugin manager Zend\View\HelperPluginManager in C:\Users\bikke_000\Documents\Sites\slapenenzo\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php:133
运行
composer需要zendframework/zend导航
修复了zf3中默认未安装导航的问题,您需要通过“导航”而不是“默认”,如下所示:
$this->navigation('navigation')->menu();
除了@Ponsjuh的答案外,我还必须在我的模块配置中包含模块“Zend\Navigation”。检查您的“开发模式”。在生产模式下,“配置缓存已启用”为true。安装新模块时,必须刷新缓存。
默认值:“data/cache/module config cache.application.config.cache.php”