Studyon Minte9.com
ZF 1.0

Study

Session



session.overview

#index.php
new Zend_Session_Namespace('defaultNamespace');

#modules/default/frontendController
...
public function sessionAction() {
	$ns = new Zend_Session_Namespace('defaultNamespace');
	$ns->setExpirationSeconds(60*60*24); // 1 day

	if (!isset($ns->countRequest)) {
		$ns->countRequest = 1;
	} else {
		$ns->countRequest++;
	}

	$this->_redirect('/default/frontend/session-test');
}

public function sessionTestAction() {
	$ns = new Zend_Session_Namespace('defaultNamespace');
	
	echo $ns->countRequest; die;
	
}

#http://zfsite/default/frontend/session 
#countRequest is incremented every time we call session action


http://www.phpeveryday.com/articles/Zend-Framework-Session-Using-Namespace-P571.html
http://framework.zend.com/manual/en/zend.session.global_session_management.html
(security risk - fixation)