国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php版微信自動(dòng)獲取收貨地址api用法示例

2024-05-04 23:49:58
字體:
供稿:網(wǎng)友

本文實(shí)例講述了php版微信自動(dòng)獲取收貨地址api用法。分享給大家供大家參考,具體如下:

微信公眾平臺(tái)現(xiàn)在是越來越強(qiáng)大了,我們可以通過各種api接口來與平臺(tái)對(duì)接獲取對(duì)應(yīng)的數(shù)據(jù)了,下面來看一個(gè)由php實(shí)現(xiàn)的微信自動(dòng)獲取收貨地址api程序,具體如下.

關(guān)于接口的說明我就不介紹了,在官方可以看到下面只看處理程序.

public function get_address_api() {  $APPID=C('APPID');  $SCRETID=C('SCRETID');  if (!isset($_GET['code'])) {    $backurl = $this->get_url();    $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$APPID."&redirect_uri=".urlencode($backurl)."&response_type=code&scope=jsapi_address&state=123#wechat_redirect";    // snsapi_userinfo    Header("Location: $url");    exit;  } else {    $code = $_GET['code'];    $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$APPID."&secret=".$SCRETID."&code=".$code."&grant_type=authorization_code";    $re = file_get_contents($url);    $rearr = json_decode($re,true);    $backurl = $this->get_url();    $openid = $rearr['openid'];    $unionid = $rearr['unionid'];    $asstoken = $rearr['access_token'];    S('jsapi_address_token'.$openid,$asstoken,7200);    $data['appid']=$APPID;    $data['url']=$backurl;    $data['timestamp']=time();    $data['timestamp']= (string)($data['timestamp']);    $data['noncestr']=$this->getRandStr(10);    $data['accesstoken']=$asstoken;    foreach ($data as $k => $v) {      $Parameters[$k] = $v;    }    //簽名步驟一:按字典序排序參數(shù)    ksort($Parameters);    $String = $this->formatBizQueryParaMap($Parameters, false);    $data['addrsign']=SHA1($String);    $this->assign('data',$data);  }  $this->siteDisplay('address_api');}

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到PHP教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 融水| 云林县| 什邡市| 三门县| 三河市| 拉萨市| 湾仔区| 楚雄市| 花莲县| 盐亭县| 新河县| 新乡市| 信丰县| 镇坪县| 郓城县| 韶关市| 朝阳区| 台北县| 公安县| 汉川市| 顺平县| 漳浦县| 玛纳斯县| 沭阳县| 银川市| 荃湾区| 大庆市| 定结县| 湖州市| 密云县| 科尔| 阳曲县| 遵化市| 延庆县| 湘潭市| 阜新市| 保康县| 清水河县| 凤阳县| 洛川县| 绩溪县|