Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用headLink helper从控制器中包含css和js文件_Php_Zend Framework2 - Fatal编程技术网

Php 如何使用headLink helper从控制器中包含css和js文件

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

我正在创建一个全局函数,该函数将初始化控制器中ZF2应用程序的所有全局和css文件。当前代码如下

    /**
    ** 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合作开始感谢!