亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

微信的網頁授權接口問題

微信的網頁授權接口問題

PHP
_桀 2016-07-08 22:16:42
在獲取code之后請求access_token時總是返回40029錯誤碼,我搜了一下發現是code重復使用的問題,但是我不知道怎么解決,求大神指點。//獲取網頁授權(詳細信息) function?getUserDetail(){ //1.獲取code $appid="*******"; $redirect_uri=urlencode("http://*******/imooc.php/Index/getUserInfo"); $url?=?"https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"; header('location:'.$url); } function?getUserInfo(){ //2.獲取網頁授權的access_token $appid="*******"; $appsecret="*******"; echo?$code=$_GET['code']; echo?"<br?/>"; $url?=?"https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$appid."&secret=".$appsecret."&code=".$code."&grant_type=authorization_code"; $res=$this->http_curl($url,'get'); var_dump($res); echo?"<br?/>"; echo?$access_token=$res["access_token"]; $openid?=$res['openid']; //3.拉去用戶的詳細信息 $url="https://api.weixin.qq.com/sns/userinfo?access_token=".$access_token."&openid=".$openid."&lang=zh_CN"; $res?=?$this->http_curl($url,'get'); var_dump($res); }
查看完整描述

1 回答

  • 1 回答
  • 2 關注
  • 2873 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號