PFinal\Wechat\Service\OAuthService::getOauthAccessToken PHP Method

getOauthAccessToken() public static method

网页授权获取用户基本信息 流程第2步 通过code换取网页授权access_token
public static getOauthAccessToken ( $code ) : array
$code
return array [ "access_token"=>"ACCESS_TOKEN", "expires_in"=>7200, //access_token接口调用凭证超时时间,单位(秒) "refresh_token"=>"REFRESH_TOKEN", "openid"=>"OPENID", "scope"=>"SCOPE" ]
    public static function getOauthAccessToken($code)
    {
        $appId = parent::getApi()->getAppId();
        $secret = parent::getApi()->getAppSecret();
        $grant_type = 'authorization_code';
        $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appId}&secret={$secret}&code={$code}&grant_type={$grant_type}";
        return parent::request($url);
    }