Php 如何使用headLink helper从控制器中包含css和js文件
我正在创建一个全局函数,该函数将初始化控制器中ZF2应用程序的所有全局和css文件。当前代码如下Php 如何使用headLink helper从控制器中包含css和js文件,php,zend-framework2,Php,Zend Framework2,我正在创建一个全局函数,该函数将初始化控制器中ZF2应用程序的所有全局和css文件。当前代码如下 /** ** Set Global media files for Application ** Rest can be initialized in controllers **/ private function setMedia() { $this->viewManager=new ViewModel; $t
/**
** Set Global media files for Application
** Rest can be initialized in controllers
**/
private function setMedia() {
$this->viewManager=new ViewModel;
$this->viewManager->headLink()
->appendStylesheet(_CB_ASSETS_PATH_.'/css/docker.css', 'all', 'IE');
return $this->viewManager;
}
但问题是我犯了错误
Fatal error: Call to undefined method Zend\View\Model\ViewModel::headLink() in C:\Apache24\htdocs\cartbiz\module\Front\src\Front\Model\FrontCore.php on line 59
非常感谢您的帮助
谢谢 就这样
$this->getServiceLocator()->get('viewhelpermanager')->get('HeadLink')->appendStylesheet(_CB_ASSETS_PATH_ . '/css/docker.css', 'all', 'IE');
@Alfredo[code]echo$this->getServiceLocator->get'viewhelpermanager'->get'HeadLink'->appendStylesheetCB_ASSETS_PATH'/css/docker.css“,”全部“,”IE“;与echo合作开始感谢!