Implements interfaces:
THttpSession class
THttpSession provides session-level data management and the related configurations. To start the session, call {@open}; to complete and send out session data, call {@close}; to destroy the session, call {@destroy}. If AutoStart is true, then the session will be started once the session module is loaded and initialized.
To access data stored in session, use THttpSession like an associative array. For example,
- $session=new THttpSession;
- $session->open();
- $value1=$session['name1']; // get session variable 'name1'
- $value2=$session['name2']; // get session variable 'name2'
- foreach($session as $name=>$value) // traverse all session variables
- $session['name3']=$value3; // set session variable 'name3'
The following configurations are available for session: AutoStart, setCookie, setCacheLimiter, SavePath, UseCustomStorage, GCProbability, setCookieUsage, Timeout. See the corresponding setter and getter documentation for more information. Note, these properties must be set before the session is started.
THttpSession can be inherited with customized session storage method. Override _open, _close, _read, _write, _destroy and _gc and set UseCustomStorage to true. Then, the session data will be stored using the above methods.
By default, THttpSession is registered with TApplication as the request module. It can be accessed via TApplication::getSession().
THttpSession may be configured in application configuration file as follows,
where SessionName, SavePath, CookieMode, UseCustomStorage, AutoStart, GCProbability, UseTransparentSessionID and getTimeOut are configurable properties of THttpSession.
- <module id="session" class="THttpSession" SessionName="SSID" SavePath="/tmp"
- CookieMode="Allow" UseCustomStorage="false" AutoStart="true" GCProbability="1"
- UseTransparentSessionID="true" TimeOut="3600" />
Located in /Web/THttpSession.php (line 64)
TComponent | --TApplicationComponent | --THttpSession
Class | Description |
---|---|
TCacheHttpSession | TCacheHttpSession class |
Adds a session variable.
Note, if the specified name already exists, the old value will be removed first.
Removes all session variables
Ends the current session and store session data.
Returns the number of items in the session.
This method is required by Countable interface.
Destroys all data registered to a session.
Returns an iterator for traversing the session variables.
This method is required by the interface IteratorAggregate.
Initializes the module.
This method is required by IModule. If AutoStart is true, the session will be started.
Returns the session variable value with the session variable name.
This method is exactly the same as offsetGet.
This method is required by the interface ArrayAccess.
This method is required by the interface ArrayAccess.
This method is required by the interface ArrayAccess.
This method is required by the interface ArrayAccess.
Starts the session if it has not started yet.
Removes a session variable.
Session close handler.
This method should be overridden if UseCustomStorage is set true.
Session destroy handler.
This method should be overridden if UseCustomStorage is set true.
Session GC (garbage collection) handler.
This method should be overridden if UseCustomStorage is set true.
Session open handler.
This method should be overridden if UseCustomStorage is set true.
Session read handler.
This method should be overridden if UseCustomStorage is set true.
Session write handler.
This method should be overridden if UseCustomStorage is set true.
Inherited From TApplicationComponent
TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()
Inherited From TComponent
TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__get()
TComponent::__set()
Documentation generated on Mon, 21 Apr 2008 11:35:11 -0400 by phpDocumentor 1.3.0RC4