The session method is used to http://www.aliyun.com/zixun/aggregation/16962.html the >session settings, get, delete, and manage operations.
Session is used for session settings, fetch, delete, and manage Action usage session ($name, $value = ') parameter name (required): If an incoming array represents a session initialization, if passing in null indicates emptying the current session, If it is a string, the session assignment, fetch, or operation is represented.
Value (optional): The session value to set, if passing in NULL represents deleting the session, the default is empty string return value See details (return different values according to the specific usage)
The session function is a multiplication function, in which different parameters can be invoked to perform different function operations, including the following functions.
Session Initialization settings
If the name parameter of the session method passes in an array, the session initialization setting is represented, for example:
Session (Array (' name ' => ' session_id ', ' expire ' =>3600));
The incoming session parameters are supported including:
Parameter name Description ID session_id Value name session_name value path Session_save_path value prefix session localization space prefix expire session.gc_maxlifetime settings Value domain Session.cookie_domain Set value use_cookies session.use_cookies set value Use_trans_sid session.use_trans_sid set Value cache_ Limiter Session_cache_limiter Set Value Cache_expire Session_cache_expire Set Value type session hander types, you can use the hander Drive extension
The session initialization method does not need to be called manually, and will be invoked automatically after the initialization of the app class is done, usually the project only needs to configure the Session_options parameter, the session_options parameter setting is an array, The supported index names are the same as the previous session initialization parameters.
By default, the system starts the session automatically after initialization, and you can set Session_auto_start to False if you do not want the system to start the session automatically, for example:
' Session_auto_start ' =>false
Turn off the public files that can be project after automatic startup or start the session in the Controller by manually calling Session_Start or session (' [Start] ').
Session Assignment
Session assignment is relatively simple, direct use:
Session (' name ', ' value '); Set session
Equivalent:
$_session[' name ' = ' value ';
Session value
Session value using:
$value = Session (' name ');
Equivalent to use:
$value = $_session[' name '];
Session deletion
Session (' name ', null); Delete Name
Equivalent:
unset ($_session[' name '));
To remove all sessions, you can use:
session (NULL); Empty the current session
Equivalent:
$_session = Array ();