我有一個自定義的認證服務,並在ZF2我訪問這個如下:如何從Zend Framework 3中的視圖腳本訪問服務?
Application/view/layout/layout.phtml
$authenticationService = $this->getHelperPluginManager()
->getServiceLocator()
->get('AuthenticationService');
$currentIdentity = $authenticationService->getIdentity();
現在Zend\ServiceManager#getServiceLocator()
已被棄用。
如何在ZF3中的視圖腳本(或在這種情況下在佈局中具體)獲得服務?
我完全同意你的觀點! – unclexo