-
Notifications
You must be signed in to change notification settings - Fork 43
oauth_access_token
刘广财 edited this page Apr 4, 2018
·
1 revision
用户 AccessToken 是通过网页授权所获取的用户接口调用凭证,有效期为 7200 秒,过期后可通过 refresh_token 来刷新。
use Itxiao6\Wechat\OAuth\Client;
$client = new Client('appid', 'appsecret');
if( !isset($_GET['code']) ) {
header('Location: '.$client->getAuthorizeUrl());
}
$accessToken = $client->getAccessToken($_GET['code']);var_dump($accessToken->isValid());if( !$accessToken->isValid() ) {
$accessToken->refresh();
}
var_dump($accessToken->toArray());$userinfo = $accessToken->getUser();
var_dump($userinfo->toArray());- 基础支持
- 网页授权
- 用户管理
- 自定义菜单
- 微信支付
- 消息管理
- 事件