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

getOauthAuthorizeUrl() public static method

网页授权获取用户基本信息 流程第1步 引导用户进入授权页面的Url (用户允许后,获取code)
public static getOauthAuthorizeUrl ( string $redirectUri, string $state = '0', string $scope = 'snsapi_userinfo' ) : string
$redirectUri string 授权后重定向的回调链接地址
$state string 重定向后会带上state参数,开发者可以填写a-zA-Z0-9的参数值
$scope string 应用授权作用域,snsapi_base (不弹出授权页面,直接跳转,只能获取用户openid),snsapi_userinfo(弹出授权页面,可通过openid拿到昵称、性别、所在地。并且,即使在未关注的情况下,只要用户授权,也能获取其信息)
return string
    public static function getOauthAuthorizeUrl($redirectUri, $state = '0', $scope = 'snsapi_userinfo')
    {
        $appId = parent::getApi()->getAppId();
        $redirectUri = urlencode($redirectUri);
        return "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appId}&redirect_uri={$redirectUri}&response_type=code&scope={$scope}&state={$state}#wechat_redirect";
    }