微信开发 获取用户openId 与路由控制
2024-09-30 22:28:53
w实践,满足当前需求。
www.w.com
www.w.com/w1.php
$wxurl='https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$wxwid.'&redirect_uri=http://www.w.com/woauth2.php&response_type=code&scope=snsapi_base&state=1#wechat_redirect';
header('Location: '.$wxurl);
www.w.com/woauth2.php
$wxurl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.$wxwid
.'&secret='.$wxws; $wxr_code = $_REQUEST['code']; $wxurl='https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$wxwid
.'&secret='.$wxws.'&code='.$wxr_code.'&grant_type=authorization_code';
$result = file_get_contents($wxurl);
$res =json_decode($result, true);
var_dump($res);
$wxr_openid=$res['openid'];
var_dump($wxr_openid);
最新文章
- debian的版本演进
- STL容器删除元素的陷阱
- 第三篇 Integration Services:增量加载-Adding Rows
- Codeforces Round #378 (Div. 2) C. Epidemic in Monstropolis 模拟
- 解决Lost connection to MySQL server at 'reading initial communication packet', 的方法
- 自定义绘制View
- android异步Http框架
- Gazebo機器人仿真學習探索筆記(二)基本使用說明
- 分享一个.NET平台开源免费跨平台的大数据分析框架.NET for Apache Spark
- ubuntu 16.04 安装 opencv +contrib (3.2.0) + python 3.5
- php安全编程&;python测试实例编写
- 你的B计划在哪里?
- Socket网络编程(三)
- Jumpserver跳板机的搭建和部署
- 12.17 Daily Scrum
- SQL中on条件与where条件的区别
- Kafka创建Topic时如何将分区放置到不同的Broker中
- nutch相关目录说明
- Oracle RAC Failover 详解
- 模板:CDQ分治