php微信公众号调用扫一扫,微信公众号中h5页面扫一扫实现

开发文档参考链接:https://mp.weixin.qq.com/wiki?t=resources / status_main&id=mp1421141115

1 配置本地nginx

server {

listen 80;

server_name localhost;

root 代码路径;

index index.html index.htm;

location /rest {

proxy_pass 访问接口配置;

proxy_set_header Host $http_host;

proxy_set_header X-Forward-For $remote_addr;

}

}

注意监听端口一定只能是80;

2 修改本机主机,修改域名指向本地

修改C:\ Windows \ System32 \ drivers \ etc \ host.ics文件,配置localhost指向

127.0.0.1域名(该域名为公众号里边配置的域名)

也可以使用switchhost来做

3 使用网页授权URL

参考链接(请在微信客户端中打开此链接体验):

scope为snsapi_base

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx520c15f417810387&redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&response_type=code&scope=snsapi_base&state=123#wechat_redirect

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

4 获取openid(必须)

通过后台接口调用

5 获取wx配置

通过后台接口调用返回

配置报错,参考该链接校验:https://www.cnblogs.com/ka-bu-qi-nuo/p/8659688.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值