Zend 框架相册示例

Zend framework album example

您好,我在相册示例中的 zendframework 2 中收到以下错误。使用 PHP 5.6.2 版本和 XAMPP。关于这个问题的任何线索..

Zend\ServiceManager\Exception\ServiceNotFoundException

文件: C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php:555

留言: Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Zend\Db\Adapter\Adapter

#0 C:\xampp\htdocs\zf2\module\Album\Module.php(42): Zend\ServiceManager\ServiceManager->get('Zend\Db\Adapter...')
#1 [internal function]: Album\Module->Album\{closure}(Object(Zend\ServiceManager\ServiceManager), 'albumtablegatew...', 'AlbumTableGatew...')
#2 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(934): call_user_func(Object(Closure), Object(Zend\ServiceManager\ServiceManager), 'albumtablegatew...', 'AlbumTableGatew...')
#3 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(1094): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Object(Closure), 'albumtablegatew...', 'AlbumTableGatew...')
#4 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(634): Zend\ServiceManager\ServiceManager->createFromFactory('albumtablegatew...', 'AlbumTableGatew...')
#5 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(597): Zend\ServiceManager\ServiceManager->doCreate('AlbumTableGatew...', 'albumtablegatew...')
#6 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#7 C:\xampp\htdocs\zf2\module\Album\Module.php(37): Zend\ServiceManager\ServiceManager->get('AlbumTableGatew...')
#8 [internal function]: Album\Module->Album\{closure}(Object(Zend\ServiceManager\ServiceManager), 'albummodelalbum...', 'Album\Model\Alb...')
#9 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(934): call_user_func(Object(Closure), Object(Zend\ServiceManager\ServiceManager), 'albummodelalbum...', 'Album\Model\Alb...')
#10 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(1094): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Object(Closure), 'albummodelalbum...', 'Album\Model\Alb...')
#11 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(634): Zend\ServiceManager\ServiceManager->createFromFactory('albummodelalbum...', 'Album\Model\Alb...')
#12 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(597): Zend\ServiceManager\ServiceManager->doCreate('Album\Model\Alb...', 'albummodelalbum...')
#13 C:\xampp\htdocs\zf2\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#14 C:\xampp\htdocs\zf2\module\Album\src\Album\Controller\AlbumController.php(37): Zend\ServiceManager\ServiceManager->get('Album\Model\Alb...')
#15 C:\xampp\htdocs\zf2\module\Album\src\Album\Controller\AlbumController.php(16): Album\Controller\AlbumController->getAlbumTable()
#16 C:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(82): Album\Controller\AlbumController->indexAction()
#17 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#18 C:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\src\EventManager.php(490): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#19 C:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\src\EventManager.php(263): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#20 C:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(118): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#21 C:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\src\DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#22 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#23 C:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\src\EventManager.php(490): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#24 C:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\src\EventManager.php(263): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#25 C:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\src\Application.php(340): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#26 C:\xampp\htdocs\zf2\public\index.php(27): Zend\Mvc\Application->run()
#27 {main}

同时显示已弃用的错误:

已弃用:您正在从 class Album\Controller\AlbumController 中检索服务定位器。请注意,ServiceLocatorAwareInterface 已弃用,并将在 3.0 版中与 ServiceLocatorAwareInitializer 一起删除。您将需要更新 class 以在创建时通过构造函数参数或设置器接受所有依赖项,并使用工厂来执行注入。在 C:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php 第 258 行

Zend\Db\Adapter\Adapter 在 module.config.php 工作