本文整理匯總了PHP中Zend\Session\Container::unsetAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::unsetAll方法的具體用法?PHP Container::unsetAll怎麽用?PHP Container::unsetAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Session\Container
的用法示例。
在下文中一共展示了Container::unsetAll方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: authenticate
/**
* Authenticate the user
*
* @return Zend_Auth_Result
*/
public function authenticate()
{
if (!$this->_consumer) {
$code = AuthenticationResult::FAILURE;
$message = array('A valid Zend\\Oauth\\Consumer key is required');
return new AuthenticationResult($code, '', $message);
}
$sessionContainer = self::DEFAULT_SESSION_CONTAINER;
if (isset($this->_options['sessionContainer']) && $this->_options['sessionContainer'] != '') {
$sessionContainer = $this->_options['sessionContainer'];
}
$session = new SessionContainer($sessionContainer);
try {
if (!$session->requestToken) {
$token = $this->_consumer->getRequestToken();
$session->requestToken = serialize($token);
$this->_consumer->redirect();
} else {
$accessToken = $this->_consumer->getAccessToken($this->_queryData, unserialize($session->requestToken));
$this->setAccessToken($accessToken);
unset($session->requestToken);
$body = $accessToken->getResponse()->getBody();
$returnParams = array();
$parts = explode('&', $body);
foreach ($parts as $kvpair) {
$pair = explode('=', $kvpair);
$returnParams[rawurldecode($pair[0])] = rawurldecode($pair[1]);
}
}
} catch (Zend\Oauth\Exception $e) {
$session->unsetAll();
$code = AuthenticationResult::FAILURE;
$message = array('Access denied by OAuth source');
return new AuthenticationResult($code, '', $message);
} catch (Exception $e) {
$session->unsetAll();
$code = AuthenticationResult::FAILURE;
$message = array($e->getMessage());
return new AuthenticationResult($code, '', $message);
}
return new AuthenticationResult(AuthenticationResult::SUCCESS, $returnParams, array());
}