How to clear a session when the vacation controller is within zend?

Suppose I am in indexAction IndexController. I saved some data in the session. Now I want to clear the entire session when I switch to another controller, say ExampleController. How can i do this?

+6
source share
2 answers

If you want to delete all session namespaces:

Zend_Session::destroy(); 

To remove one specific Space name:

  Zend_Session::namespaceUnset('default'); 
+17
source

possibly with

 $bootstrap = $this->getInvokeArg('bootstrap'); $cache = $bootstrap->getResource('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_ALL); 
-2
source

Source: https://habr.com/ru/post/894612/


All Articles