1.第一步

$hosturl = urlencode('');//异步回调地址
$wechatInfo = WechatInfo::get_wechat(); //查询appid
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$wechatInfo['appid']}&redirect_uri={$hosturl}&response_type=code&scope=snsapi_base&state={$user['user_id']}#wechat_redirect";
$result = ['status' => 2, 'msg' => '登陆成功', 'data' => $user, 'url' => $url];

2.异步回调地址

$code = input('code');
$user_id = input('state');
$wechatInfo = WechatInfo::get_wechat();
$appid = $wechatInfo['appid'];
$secret = $wechatInfo['appsecret'];
$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$secret}&code={$code}&grant_type=authorization_code";
$sdk =Jssdk::curlGet($url);

有那些不明白的,可以在评论里留言,我会及时的回复大家的

最新文章

  1. UI控件(UIButton)
  2. LOL
  3. 关于几种编程过程中的注释(TODO、FIXME、XXX等)
  4. 【如何快速的开发一个完整的iOS直播app】(美颜篇)
  5. zju3545
  6. SQL Server 2008 R2——VC++ ADO 操作 参数化查询
  7. JS 日历控件
  8. dataAdapter与dataSet和dataTable的填充
  9. LintCode-Word Segmentation
  10. Cocos2d-x——支持多触点
  11. 插入排序InsertionSort
  12. SWMM代码移植到64位平台
  13. entity framework 动态条件
  14. effective c++ prefer const,enum, inline to #defines
  15. MySql 事务与锁
  16. [标]ORACLE常用的一些语句记录
  17. 6年后的第一篇博客:进入java的精彩世界
  18. Yii中DataProvider的使用
  19. 【Linux】Jenkins安装(二)
  20. 为WebRTC 应用部署Turn Server

热门文章

  1. 基于loghub的消息消费延迟监控
  2. JAVA中快速生成get与set
  3. 为什么坚果云Markdown值得使用?
  4. 【软件工具】easyExcel简明使用指南
  5. centos6.7下安装glibc-2.17
  6. Vue项目解析
  7. elastic search(es)安装
  8. Dictionary的遍历
  9. 分布式主键解决方案之--Snowflake雪花算法
  10. 怎么解决js中如滑动到最底端一次操作触发多次