如何删除 ZF2 中特定页面布局中的资产
How to remove asset which was in layout on particular page in ZF2
我在我的网站上 layout.phtml
全局设置了此资产:
$this->InlineScript()
->offsetSetFile(4, $this->basePath('crm-assets/js/permissions.js'))
如何删除网站特定页面上的这个文件?
有什么方法吗:
$this->InlineScript()->unset(4)
?
视图助手继承自 Zend\View\Helper\Placeholder\Container\AbstractStandalone
,后者实现 ArrayObject
并代理 所有 对其管理的 'collection' 的大部分调用。
通常你可以使用unset()
函数
$helper = $this->inlineScript();
unset($helper->someKey}
然而,由于密钥是 integer
,您需要从内部容器调用 offsetUnset()
。
$helper->getContainer()->offsetUnset(4);
我在我的网站上 layout.phtml
全局设置了此资产:
$this->InlineScript()
->offsetSetFile(4, $this->basePath('crm-assets/js/permissions.js'))
如何删除网站特定页面上的这个文件?
有什么方法吗:
$this->InlineScript()->unset(4)
?
视图助手继承自 Zend\View\Helper\Placeholder\Container\AbstractStandalone
,后者实现 ArrayObject
并代理 所有 对其管理的 'collection' 的大部分调用。
通常你可以使用unset()
函数
$helper = $this->inlineScript();
unset($helper->someKey}
然而,由于密钥是 integer
,您需要从内部容器调用 offsetUnset()
。
$helper->getContainer()->offsetUnset(4);