【发布时间】:2017-06-24 10:33:17
【问题描述】:
我有一个自定义身份验证服务,在 ZF2 中我按如下方式访问它:
Application/view/layout/layout.phtml
$authenticationService = $this->getHelperPluginManager()
->getServiceLocator()
->get('AuthenticationService');
$currentIdentity = $authenticationService->getIdentity();
现在Zend\ServiceManager#getServiceLocator() 已弃用。
如何在 ZF3 中的视图脚本(或本例中的布局中的具体)中获取服务?
【问题讨论】:
标签: migration service-locator zend-view zend-framework3 zend-servicemanager