Home  >  Article  >  Backend Development  >  微信OAuth2.0网页受权php示例

微信OAuth2.0网页受权php示例

WBOY
WBOYOriginal
2016-06-13 12:30:04712browse

微信OAuth2.0网页授权php示例

1、配置授权回调页面域名,如 www.aaa.com

?

2、模拟公众号的第三方网页,fn_system.php

?

3、访问第三方网页时,如果检查session中不存在会话信息,则跳转至登陆页,fn_wx_login.php

?

4、在登陆页组装appid,回跳url等信息,然后跳转至微信的用户授权页。

?

5、在微信的用户授权页,如果用户选择了“同意授权”,则微信重新回跳至第三方网页的回跳地址时,会附带上code参数。

?

6、第三方网页的回跳url中,首先从请求中取得code,然后根据code进一步换取openid和access_token,然后就可以根据openid和access_token调用微信的相关接口查询用户信息了。

?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn