将ZF2迁移到ZF3:在插件管理器中找不到Zend \ Mvc \ Router \ Http \ Segment

时间:2017-06-23 23:47:12

标签: migration zend-framework3 zend-servicemanager

我正在将ZF2应用程序迁移到ZF3。

首先我收到错误:

Fatal error: Uncaught Zend\ModuleManager\Listener\Exception\RuntimeException: Could not find a valid ServiceManager for RoutePluginManager in /var/www/work/path/to/project/vendor/zendframework/zend-modulemanager/src/Listener/ServiceListener.php on line 202
Zend\ModuleManager\Listener\Exception\RuntimeException: Could not find a valid ServiceManager for RoutePluginManager in /var/www/work/path/to/project/vendor/zendframework/zend-modulemanager/src/Listener/ServiceListener.php on line 202

'Zend\Router'添加到modules中的application.config.php数组解决了这个问题。但现在我又收到了另一个错误:

Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: A plugin by the name "Zend\Mvc\Router\Http\Segment" was not found in the plugin manager Zend\Router\RoutePluginManager in /var/www/work/path/to/project/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php on line 131
Zend\ServiceManager\Exception\ServiceNotFoundException: A plugin by the name "Zend\Mvc\Router\Http\Segment" was not found in the plugin manager Zend\Router\RoutePluginManager in /var/www/work/path/to/project/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php on line 131

可能导致此错误的原因以及如何解决此问题?

1 个答案:

答案 0 :(得分:3)

Zend\Mvc\Router引起的问题已移至Zend\Router,因此只需将Zend\Mvc\Router\Http\Segment替换为Zend\Router\Http\Segment