微信登录授权页面重定位的时候,只接收一个参数

摘自:http://www.tuicool.com/articles/y2InYrV

微信开发通过网页授权获取用户基本信息时,可能会需要一些参数,通过验证redirect_url中的参数只能放置一个,例如:
https://open.weixin.qq.com/connect/oauth2/authorize?appid=appid&

redirect_uri=http://ip:port/app/method?appid=1&appType=service

&response_type=code&scope=snsapi_base&state=123#wechat_redirect
此时appType=service这个参数是没有的,微信平台给处理掉了

想到了一种解决办法,组织参数为json字符串,例如
param={"appid":1,"appType":"service"}
注意,参数必须进行编码才可行

通过这种方式,就可以在redirect_url中添加多个参数了

posted @ 2017-06-28 13:44  包远志  阅读(5343)  评论(0编辑  收藏  举报