会长001
2016-08-01 13:00
//获取用户的openid
function getBaseInfo(){
//1.获取到code
$appid = "wx878587085d5d8cc6";
$redirect_uri = urlencode("http://guoyuzhao.xinliu.org/App/imooc.php/Index/getWxCode");
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
header('location:'.$url);
}
function getUserOpenId(){
//2.获取到网页授权的access_token
$appid = "wx878587085d5d8cc6";
$appsecret = "5e103535b2e461158745da3b5e30d515";
$code = $_GET['code'];
$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$appid."&secret=".$appsecret"&code=".$code."&grant_type=authorization_code ";
//3.拉取用户的openid
$res = $this->http_curl($url,'get');
var_dump($res);
}
仔细看视频 他之后改了 没和你说 他改成getUserOpenId了
PHP微信公众平台开发高级篇—网页授权接口
28432 学习 · 111 问题
相似问题
回答 1
回答 1