2017-07-28 78 views
-1

我使用Zend框架3教义2,它给我这个错误我硝基甲苯知道为什么ServiceNotFoundException的”“无法解析服务‘路由器’的工厂

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

+0

请将您的'module.config.php'粘贴到这里 –

回答

1

我得到了同样的问题,而升级从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', 
    ... 
]; 

我得到了modules.config.php从zf3 skeleton application新application.config.php。