ServiceNotFoundException' '无法将服务 "Router" 解析为工厂
ServiceNotFoundException' 'Unable to resolve service "Router" to a factory
我将 zend 框架 3 与学说 2 一起使用,它给了我这个错误,我不知道为什么
Fatal error: Uncaught exception
'Zend\ServiceManager\Exception\ServiceNotFoundException' with message
'Unable to resolve service "Router" to a factory; are you certain you
provided it during configuration?' in
C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php:681
Stack trace: #0
C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(757):
Zend\ServiceManager\ServiceManager->getFactory('Router') #1
C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(200):
Zend\ServiceManager\ServiceManager->doCreate('Router') #2
C:\xampp\htdocs\zendf\vendor\zendframework\zend-mvc\src\Application.php(158):
Zend\ServiceManager\ServiceManager->get('Router') #3
C:\xampp\htdocs\zendf\vendor\zendframework\zend-mvc\src\Application.php(273):
Zend\Mvc\Application->bootstrap(Array) #4
C:\xampp\htdocs\zendf\public\index.php(40):
Zend\Mvc\Application::init(Array) #5 {main} thrown in
C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php
on line 681
我在将应用程序从 zf2 升级到 zf3 时遇到了同样的问题。
我通过加载模块 Zend\Router 解决了这个问题。 ZF3 附带了更多模块,所以我最终在 modules.config.php:
中使用了它
return [
'Zend\Cache',
'Zend\Form',
'Zend\Hydrator',
'Zend\InputFilter',
'Zend\Paginator',
'Zend\I18n',
'Zend\Filter',
'Zend\Router',
'Zend\Validator',
'Zend\Navigation',
...
];
我从 zf3 skeleton application 得到了 modules.config.php 和新的 application.config.php。
我将 zend 框架 3 与学说 2 一起使用,它给了我这个错误,我不知道为什么
Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Unable to resolve service "Router" to a factory; are you certain you provided it during configuration?' in C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php:681 Stack trace: #0 C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(757): Zend\ServiceManager\ServiceManager->getFactory('Router') #1 C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(200): Zend\ServiceManager\ServiceManager->doCreate('Router') #2 C:\xampp\htdocs\zendf\vendor\zendframework\zend-mvc\src\Application.php(158): Zend\ServiceManager\ServiceManager->get('Router') #3 C:\xampp\htdocs\zendf\vendor\zendframework\zend-mvc\src\Application.php(273): Zend\Mvc\Application->bootstrap(Array) #4 C:\xampp\htdocs\zendf\public\index.php(40): Zend\Mvc\Application::init(Array) #5 {main} thrown in C:\xampp\htdocs\zendf\vendor\zendframework\zend-servicemanager\src\ServiceManager.php on line 681
我在将应用程序从 zf2 升级到 zf3 时遇到了同样的问题。
我通过加载模块 Zend\Router 解决了这个问题。 ZF3 附带了更多模块,所以我最终在 modules.config.php:
中使用了它return [
'Zend\Cache',
'Zend\Form',
'Zend\Hydrator',
'Zend\InputFilter',
'Zend\Paginator',
'Zend\I18n',
'Zend\Filter',
'Zend\Router',
'Zend\Validator',
'Zend\Navigation',
...
];
我从 zf3 skeleton application 得到了 modules.config.php 和新的 application.config.php。