微信获取用户openid

   @GetMapping({"/getOpenId"})
    public void getOpenId(HttpServletResponse response)
    {
        try
        {
            StringBuffer sb = new StringBuffer();
            try
            {
                sb.append("https://open.weixin.qq.com/connect/oauth2/authorize?appid=***************&redirect_uri=").append(URLEncoder.encode("http://********授权地址*******/wechat/login", "utf-8"));
                sb.append("&response_type=code&scope=snsapi_userinfo&state=2#wechat_redirect");
            }
            catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
            response.sendRedirect(sb.toString());
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

微信获取用户openid

上一篇:小程序(三)


下一篇:小程序滚动条 无法滚动BUG 解决方案