Zend Framework Session: Accessing Session Data


Zend Framework Session Step By Step Tutorial - Part 3: In this post, we learn how to access session data. Now, we talk about how to access the session.

Please, give attention a code at previous post:

$ns = new Zend_Session_Namespace('HelloWorld');
    
if(!isset($ns->yourLoginRequest)){
  $ns->yourLoginRequest = 1;
}else{
  $ns->yourLoginRequest++;
}

From above, we know how to set session at Zend framework. Just give properties such as:

$ns->yourLoginRequest = 1;
$ns->thisIsSession = "Oke";
$ns->nameOfSession = "MySession";
$ns->foo = 10;

Now, how to access the values? Just simple:

echo $ns->yourLoginRequest;
echo $ns->thisIsSession;
echo $ns->nameOfSession;
echo $ns->foo;


Series this article:
Zend Framework Session: Introduction
Zend Framework Session: Using Namespace
Zend Framework Session: Accessing Session Data
Zend Framework Session: Seing All Values at Namespace
Zend Framework Session: Locking and Unlocking Namespace
Zend Framework Session: Automatic Expiration

Bookmark and Share Tag: framework, zend, zend framework, session Category: PHP Framework Post : April 23rd 2008 Read: 47,835

advertisements


blog comments powered by Disqus