Zend Framework:如何从HeadLink助手中取消设置一个样式表

Zip*_*ppp 6 php zend-framework stylesheet viewhelper

我在Controller init()中有一个常见样式列表:

$this->view->headLink()->setStylesheet('/style/style.css');
$this->view->headLink()->appendStylesheet('/style/style2.css');
$this->view->headLink()->appendStylesheet('/style/style3.css');
$this->view->headLink()->appendStylesheet('/style/forms.css');
$this->view->headLink()->appendStylesheet('/style/ie_patches.css','all','lte IE 7');
Run Code Online (Sandbox Code Playgroud)

我需要的是稍后在该控制器的一个动作中从堆栈中删除其中一个样式表的方法.

感谢您的帮助,请原谅我的英语

Poe*_*rin 7

或者你可以使用

$this->view->headLink()->offsetUnset($offsetToBeRemoved); // offsetToBeRemoved should be integer
Run Code Online (Sandbox Code Playgroud)

要查找offsetToBeRemoved,您可以获取iterator($this->view->headLink()->getIterator())或容器$this->view->headLink()->getContainer()),循环访问它并获取您感兴趣的密钥.