CHttpSession
Name | session |
---|---|
Class | CHttpSession |
Location | /home/vhosts/app-manager.eu5.org/framework/web/CHttpSession.php |
CHttpSession provides session-level data management and the related configurations.
To start the session, call {@link open()}; To complete and send out session data, call {@link close()}; To destroy the session, call {@link destroy()}. If {@link autoStart} is set true, the session will be started automatically when the application component is initialized by the application. CHttpSession can be used like an array to set and get session data. For example,
To start the session, call {@link open()}; To complete and send out session data, call {@link close()}; To destroy the session, call {@link destroy()}. If {@link autoStart} is set true, the session will be started automatically when the application component is initialized by the application. CHttpSession can be used like an array to set and get session data. For example,
$session=new CHttpSession; $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:
- {@link setSessionID sessionID};
- {@link setSessionName sessionName};
- {@link autoStart};
- {@link setSavePath savePath};
- {@link setCookieParams cookieParams};
- {@link setGCProbability gcProbability};
- {@link setCookieMode cookieMode};
- {@link setUseTransparentSessionID useTransparentSessionID};
- {@link setTimeout timeout}.
Options
Displaying 1-10 of 10 results.
Name | Value | Description | Type |
---|---|---|---|
autoStart | true | Whether the session should be automatically started when the session application component is initialized, defaults to true. | boolean |
behaviors | array() | The behaviors that should be attached to this component. The behaviors will be attached to the component when {@link init} is called. Please refer to {@link CModel::behaviors} on how to specify the value of this property. | array |
sessionID | null | The session ID for the current session | string |
sessionName | null | The session name for the current session, must be an alphanumeric string, defaults to PHPSESSID | string |
savePath | null | The current session save path @throws CException if the path is not a valid directory | string |
cookieParams | null | Sets the session cookie parameters. The effect of this method only lasts for the duration of the script. Call this method before the session starts. cookie parameters, valid keys include: lifetime, path, domain, secure. @see http://us2.php.net/manual/en/function.session-set-cookie-params.php | array |
cookieMode | null | How to use cookie to store session ID. Valid values include 'none', 'allow' and 'only'. | string |
gCProbability | null | The probability (percentage) that the gc (garbage collection) process is started on every session initialization. @throws CException if the value is beyond [0,100] | integer |
useTransparentSessionID | null | Whether transparent sid support is enabled or not. | boolean |
timeout | null | The number of seconds after which data will be seen as 'garbage' and cleaned up | integer |