0
A
回答
3
您可以创建自己的侦听器,该侦听器在基于特定控制器分离事件的zdt逻辑之前触发。
<?php
namespace Application\Listener;
use Zend\EventManager\AbstractListenerAggregate;
use Zend\Mvc\MvcEvent;
use Zend\ServiceManager\ServiceLocatorInterface;
class DetachZdtListener extends AbstractListenerAggregate
{
protected $listeners = array();
protected $serviceLocator;
public function __construct(ServiceLocatorInterface $serviceLocator)
{
$this->serviceLocator = $serviceLocator;
}
public function attach(\Zend\EventManager\EventManagerInterface $events)
{
// Attach a listener to the finish event that has a priority sooner
// than the ZDT listener(s)
$this->listeners[] = $events->attach(MvcEvent::EVENT_FINISH,
array($this, 'onFinish'), -9499
);
}
/**
* The method called when event is fired
*
* @param \Zend\Mvc\MvcEvent $e
*/
public function onFinish(MvcEvent $e) {
$controller = $e->getController();
if ($controller === 'Application\Controller\SomeController') {
$sm = $this->serviceLocator;
$eventManager = $e->getApplication()->getEventManager();
$sharedEventManager = $eventManager->getSharedManager();
$eventManager->detachAggregate($sm->get('ZendDeveloperTools\FlushListener'));
$eventManager->detachAggregate($sm->get('ZendDeveloperTools\ProfilerListener'));
$sharedEventManager->clearListeners('profiler');
}
}
}
那么你就只需要在一个FO你的模块的onBootstrap方法连接这个监听器,它应该做你要找的东西。
相关问题
- 1. Java开发人员的开发工具
- 2. 禁用Internet Explorer 8开发人员工具
- 3. 禁用Chrome开发人员工具的$功能
- 4. 如何在Chrome开发人员工具中禁用JavaScript
- 5. 禁用Internet Explorer 8开发人员工具的自动启动
- 6. 加载时禁用了CSS样式(开发人员工具)
- 7. 禁用Chrome控制台开发人员工具
- 8. Chrome开发人员工具错误
- 9. 其他Android开发人员工具
- 10. Chrome开发人员工具css编辑
- 11. Opera 18 Web开发人员工具
- 12. 看到开发人员工具
- 13. Atom/Electron开发人员工具主题
- 14. Ruby/Rails开发人员的JSP工具?
- 15. Google Chrome开发人员工具
- 16. IE开发人员工具栏问题
- 17. Chrome开发人员工具javascript版本
- 18. 开发人员工具崩溃IE9
- 19. XCode和开发人员工具
- 20. Facebook开发人员工具包 - ExtendedPermissons
- 21. IE11开发人员工具错误
- 22. IE10开发人员工具的禁用菜单具有灰色脚本
- 23. 如何在使用Javascript的Chrome浏览器中禁用开发人员工具
- 24. Chrome开发人员工具的构建覆盖工具
- 25. console.log在ie9中使用警报,开发人员工具打开
- 26. 开发人员工具打开时,Javascript onclick不会触发
- 27. 在编译的应用程序中打开开发人员工具的工具
- 28. 如何以编程方式禁用Chrome开发人员工具中的JavaScript?
- 29. 在Chrome开发人员工具中禁用自动保存CSS更改
- 30. 在Chrome开发人员工具中保存禁用的CSS属性
为什么不只是在你的config.php文件夹中禁用它们? – cptnk
我不想全局禁用它。 –