本文整理汇总了PHP中SimpleSAML_Session::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Session::instance方法的具体用法?PHP SimpleSAML_Session::instance怎么用?PHP SimpleSAML_Session::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSAML_Session
的用法示例。
在下文中一共展示了SimpleSAML_Session::instance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: useTransientSession
/**
* Use a transient session.
*
* Create a session that should not be saved at the end of the request.
* Subsequent calls to getInstance() will return this transient session.
*/
public static function useTransientSession()
{
if (isset(self::$instance)) {
/* We already have a session. Don't bother with a transient session. */
return;
}
self::$instance = new SimpleSAML_Session(TRUE);
}
示例2: load
/**
* Load a given session as the current one.
*
* This method will also set the track ID in the logger to the one in the given session.
*
* Warning: never set self::$instance yourself, call this method instead.
*
* @param SimpleSAML_Session $session The session to load.
* @return SimpleSAML_Session The session we just loaded, just for convenience.
*/
private static function load(SimpleSAML_Session $session)
{
SimpleSAML\Logger::setTrackId($session->getTrackID());
self::$instance = $session;
return self::$instance;
}
示例3: getInstance
/**
* Retrieves the current session. Will create a new session if there isn't a session.
*
* @return The current session.
*/
public static function getInstance()
{
/* Check if we already have initialized the session. */
if (isset(self::$instance)) {
return self::$instance;
}
/* Check if we have stored a session stored with the session
* handler.
*/
self::$instance = self::loadSession();
if (self::$instance !== NULL) {
//print "FOUND AND IS USING A SESSION INSTANCE<br>"; // TODO remove
return self::$instance;
}
//print "DID NOT FIND A SESSION INSTANCE<br>"; // TODO Remove
/* Create a new session. */
self::$instance = new SimpleSAML_Session();
/* Save the new session with the session handler. */
$sh = SimpleSAML_SessionHandler::getSessionHandler();
$sh->set('SimpleSAMLphp_SESSION', self::$instance);
return self::$instance;
}
示例4: useTransientSession
/**
* Use a transient session.
*
* Create a session that should not be saved at the end of the request.
* Subsequent calls to getInstance() will return this transient session.
*/
public static function useTransientSession()
{
if (isset(self::$instance)) {
// we already have a session, don't bother with a transient session
return;
}
self::$instance = new SimpleSAML_Session(true);
}