本文整理汇总了PHP中storage::set方法的典型用法代码示例。如果您正苦于以下问题:PHP storage::set方法的具体用法?PHP storage::set怎么用?PHP storage::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类storage
的用法示例。
在下文中一共展示了storage::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* Goes through the client authorization routine. This routine both
* redirects a user to the Google Accounts authorization screen as well as
* handle the response from the authorization service to retrieve the
* authorization code then exchange it for an access token. This method
* also removes the authorization code from the URL to keep things pretty.
* Details on how the apiClient implements authorization can be found here:
* http://code.google.com/p/google-api-php-client/source/browse/trunk/src/auth/apiOAuth2.php#84
* If an authorization error occurs, the exception is caught and the error
* message is saved in $error.
*/
public function authenticate()
{
try {
$accessToken = $this->client->authenticate();
$this->storage->set($accessToken);
// Keep things pretty. Removes the auth code from the URL.
if ($_GET['code']) {
header("Location: {$this->controllerUrl}");
}
} catch (Google_AuthException $e) {
$this->errorMsg = $e->getMessage();
}
}