先将 链接拼接编译
scope为snsapi_userinfo
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0e81c3bee622d60&redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
<body> <a onclick="dianji()">点击</a> </body> </html> <script src="Scripts/jquery-3.4.1.min.js"></script> <script> //点击调用此方法 function dianji() { //拼接跳转链接 var dz = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0e81c3bee622d60&redirect_uri="; //编译Url var REDIRECT_URI = encodeURIComponent("http://nba.bluewebgame.com"); var dzq="&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect" //拼接后的链接 var url = dz + REDIRECT_URI + dzq; //跳转此链接 } </script>
编写后 将此代码用浏览器 并使用F12键 将url的值输出出来 将输出后的链接使用 微信WEB开发者工具打开 运行此链接后得到下图展现的效果 授权获取COde则获取成功
原文地址:https://www.cnblogs.com/yutang-wangweisong/p/12144444.html
时间: 2024-10-23 13:58:55