Reputation: 1664
I haven't been able to find any clear information on how to extract the session data that's inserted automatically by php upon visiting a page for the first time.
I'm using the usual way of storing sessions into the database using application.ini. So now, I need to get the sessionid of a non-logged in person. What namespace do I use to get the data? Here is my application.ini
resources.session.saveHandler.class = "Zend_Session_SaveHandler_DbTable"
resources.session.saveHandler.options.name = "sessions"
resources.session.saveHandler.options.primary = "id"
resources.session.saveHandler.options.modifiedColumn = "modified"
resources.session.saveHandler.options.dataColumn = "data"
resources.session.saveHandler.options.lifetimeColumn = "lifetime"
So now, I see that when a person visits the site it adds a session, but how can I gain access to that session data?
I only know how to set a session namespace when a user is logged in, but when not logged in I don't create a session manually or anything, so I'm lost.
I can't figure out how to formulate this question in a clearer way.
Looking for something along the lines of
$NonLoggedInSession = new Zend_Session_Namespace('Zend_Session_namesapce(?)');
$NonLoggedInSession -> sessionid // should return something like 21hir1GI31!1gotig1 (the session id it created in the database)
Upvotes: 1
Views: 317
Reputation: 8519
Zend_Session::getIterator()
should return an iterable object that contains all Zend_Session_Namespace
objects.
Zend_Session::getId()
is probably what you are looking for, this will return the value of the current session cookie, at least does in my application.
To retrieve the name of that session cookie Zend_Session::getOptions('name')
Keep in mind that the application I'm using to test these calls does not set any session cookie explicitly. I do use Zend_Session_Namespace to persist data at various points in the application. So any session cookies set are the result of the Zend Framework Defaults.
The values returned to my application match the values present when I view cookie in Firefox.
Upvotes: 1