在Kohana 2.x中有没有办法恢复会话,知道它的ID?
答案 0 :(得分:2)
来自Kohana 2. *存储库:Line 113 of system/libraries/Session.php。 Session::instance
允许传入ID。
/**
* Singleton instance of Session.
*
* ##### Example
*
* // This is the idiomatic and preferred method of starting a session
* $session = Session::instance();
*
* @param string Force a specific session_id
*/
public static function instance($session_id = NULL)
{
if (Session::$instance == NULL)
{
// Create a new instance
new Session($session_id);
}
elseif( ! is_null($session_id) AND $session_id != session_id() )
{
throw new Kohana_Exception('A session (SID: :session:) is already open, cannot open the specified session (SID: :new_session:).', array(':session:' => session_id(), ':new_session:' => $session_id));
}
return Session::$instance;
}