简体   繁体   中英

How to unregister a controller plugin in Zend Framework

How do you unregister or disable a controller plugin from within a controller action.

class IndexController
{
    public function indexAction()
    {
        // disable plugin here
        // do some other stuff
    }
}

First get an instance of the front controller, then an instance of the plugin by a given name (class name), and lastly call the unregisterPlugin() method.

public function disableSomePluign()
{
    $frontController = $this->getFrontController();
    $plugin = $frontController->getPlugin('Some_Plugin');
    $frontController->unregisterPlugin($plugin);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM