请帮助我解决这个问题:
我遵循的链接:项目示例的https://framework.zend.com/manual/2.4/en/user-guide/database-and-models.html
我使用zend 2创建了新项目示例,但在步骤“数据库和模型”中,我遇到了一个问题:
An error occurred
An error occurred during execution; please try again later.
Additional information:
Zend\ServiceManager\Exception\ServiceNotFoundException
文件:
D:\HungVT\Projects\zend\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php:133
消息:
在插件中找不到名为“getServiceLocator”的插件 经理Zend \ Mvc \ Controller \ PluginManager
堆栈追踪:
#0 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\Controller\PluginManager.php(98): Zend\ServiceManager\AbstractPluginManager->get('getServiceLocat...', NULL)
#1 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(258): Zend\Mvc\Controller\PluginManager->get('getServiceLocat...', NULL)
#2 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(273): Zend\Mvc\Controller\AbstractController->plugin('getServiceLocat...')
#3 D:\HungVT\Projects\zend\module\Album\src\Album\Controller\AlbumController.php(38): Zend\Mvc\Controller\AbstractController->__call('getServiceLocat...', Array)
#4 D:\HungVT\Projects\zend\module\Album\src\Album\Controller\AlbumController.php(38): Album\Controller\AlbumController->getServiceLocator()
#5 D:\HungVT\Projects\zend\module\Album\src\Album\Controller\AlbumController.php(18): Album\Controller\AlbumController->getAlbumTable()
#6 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(78): Album\Controller\AlbumController->indexAction()
#7 D:\HungVT\Projects\zend\vendor\zendframework\zend-eventmanager\src\EventManager.php(271): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#8 D:\HungVT\Projects\zend\vendor\zendframework\zend-eventmanager\src\EventManager.php(151): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#9 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(105): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#10 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\DispatchListener.php(119): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#11 D:\HungVT\Projects\zend\vendor\zendframework\zend-eventmanager\src\EventManager.php(271): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 D:\HungVT\Projects\zend\vendor\zendframework\zend-eventmanager\src\EventManager.php(151): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 D:\HungVT\Projects\zend\vendor\zendframework\zend-mvc\src\Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#14 D:\HungVT\Projects\zend\public\index.php(40): Zend\Mvc\Application->run()
#15 {main}
非常感谢,
答案 0 :(得分:1)
尝试另一个教程https://docs.zendframework.com/tutorials/getting-started/database-and-models。如果我没弄错的话,getServiceLocator()就不存在了。