40029問題
一直都返回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); }
2016-10-05
你解決了嗎?我也是遇到這個問題