2014-09-22 36 views
0

我使用ZF2 ...如何可以在視圖幫助中調用服務管理器? 我的探頭就是這樣。我使用slug模塊進行sef連接。 (鏈接:https://packagist.org/packages/olliebrennan/zf2-slug-generator如何在我的視圖中調用服務管理器?

我需要從視圖助手中調用它的服務。但是,如何做到這一點?

class CommonHelper extends AbstractHelper 
{ 
    public function getSefLink($link){ 
     //my problem is here, how can i call service locator?? 
     $slug = $this->getServiceLocator()->get('SeoUrl\Slug'); 
     return $slug->create($link); 
    } 
} 

回答

相關問題