Class reference table - sessionManager
PHP itself provides session management. For this reason the super global variable $_SESSION
is used to store the session data and several functions allow to start, create or delete a session.
To have a tool for transparent session management some more code must be added to use the session
commonly within several program parts. This issue is solved by the sessionManager of
the adventure php framework. If a session is needed within an application the session manager can
be initialized by
$sessMgr = new sessionManager('{ApplikationsNamespace}');
"{ApplikationsNamespace}" thereby describes the namespace of the session, that should be
used in further code parts. Commonly the namespace is filled with the namespace of the current
application to indicate affiliation. To be able to use the session manager it must be imported
using the directive
import('core::session','sessionManager');
The sessionManager partitions the session provided by PHP natively into different namespaces
in order to use on PHP session multiple times by adventure php framework applications at the same
time.
$sessMgr->saveSessionData('MyParam','MyValue');
makes it able to store data in the session namespace defined by instanciating the session manager.
Besides, the sessionManager makes sure that the session is always existent while using it
in an application. session_start() is not necessary any more.
Data stored in a session namespace can easily gathered by
echo $sessMgr->loadSessionData('MyParam');
The data displayed in this example is read from the namespace the session manager was initialized
with. To initiate a logout procedure all data within a specific namespace can be deleted by
$sessMgr->destroySession('{ApplikationsNamespace}');
Afterwards calling loadSessionData() returns false.
Comments
Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.
|