<strike id="cy2gs"><menu id="cy2gs"></menu></strike>
  • <del id="cy2gs"><dfn id="cy2gs"></dfn></del>
  • 獲取網(wǎng)頁授權(quán)

    2018-4-23    seo達(dá)人

    如果您想訂閱本博客內(nèi)容,每天自動(dòng)發(fā)到您的郵箱中, 請(qǐng)點(diǎn)這里

    在微信登錄中,如何和獲取網(wǎng)頁授權(quán)。

    一、登錄微信測(cè)試公眾品平臺(tái),修改網(wǎng)頁授權(quán)基本信息,輸入授權(quán)回調(diào)頁面域名(自己的域名)。

    然后重新建立一個(gè)tp框架 編寫方法如圖:

    [php] view plain copy
    1. <?php  
    2. namespace Home\Controller;  
    3. use Think\Controller;  
    4. class IndexController extends Controller {  
    5.     public function index(){  
    6.        $appid='wx27f664ab15ecb71d';  
    7.        $redirect_uri=urlencode('http://www.crimson1.top/vote/index.php/home/index/getcode');  
    8.        $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=$redirect_uri&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";  
    9.   
    10.              header("Location:".$url);  
    11.     }  
    12.   
    13.     public function getcode(){  
    14.         $code=$_GET["code"];  
    15.          $json=$this->access_token($code);  
    16.          echo $json;  
    17.     }  
    18.     public function access_token($code){  
    19.         $appid="wx27f664ab15ecb71d";  
    20.         $appsecret="015756334f2982ed1189c6d66dbc0353";  
    21.         $url="https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code";  
    22.   
    23.         $ret=https_request($url);  
    24.         return $ret;  
    25.     }  
    26. }  

    在公共模塊中新建function.php

    [php] view plain copy
    1. <?php  
    2. function https_request($url){  
    3.     $curl=curl_init();  
    4.     curl_setopt($curl, CURLOPT_URL, $url);  
    5.     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);  
    6.     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);  
    7.     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  
    8.     $data=curl_exec($curl);  
    9.     if(curl_errno($curl)){  
    10.         return 'ERROR'.curl_error($curl);  
    11.     }  
    12.     curl_close($curl);  
    13.     return $data;  
    14. }  

    在自己的手機(jī)端訪問,就能獲取access_token;

    藍(lán)藍(lán)設(shè)計(jì)www.skdbbs.com )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì) 、 cs界面設(shè)計(jì) 、 ipad界面設(shè)計(jì) 、 包裝設(shè)計(jì) 、 圖標(biāo)定制 、 用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 平面設(shè)計(jì)服務(wù)

    日歷

    鏈接

    個(gè)人資料

    存檔

    主站蜘蛛池模板: 久久精品国产亚洲一区二区三区| 亚洲线精品一区二区三区影音先锋| 久久精品亚洲欧美日韩久久| 精品无码国产一区二区三区AV| 国产午夜精品一本在线观看| 国产精品扒开腿做爽爽爽视频| 久久精品视屏| 欧美黑人巨大精品| 精品国产一区二区三区无码 | 99re热这里只有精品视频中文字幕 | 中国精品18videosex性中国| 国产精品哟女在线观看| 影视网欧洲精品| 精品国产福利第一区二区三区| 精品国产福利在线观看| 一色屋精品视频在线观看| 久久精品国产一区二区电影| 99精品人妻少妇一区二区| 久久九九亚洲精品| 精品九九久久国内精品| 国产精品无码一区二区三区电影| 中文字幕日韩精品有码视频 | 香蕉国产精品频视| 好吊妞视频精品| 国产日韩一区在线精品欧美玲| 国产日韩精品中文字无码| 无码精品久久久久久人妻中字| 亚洲精品专区| 尤物国精品午夜福利视频| 亚洲性日韩精品国产一区二区 | 久久亚洲av无码精品浪潮| 精品人体无码一区二区三区| 国产午夜精品一本在线观看 | 国产精品福利在线观看| 99国产精品久久| 国产福利微拍精品一区二区| 99热门精品一区二区三区无码| 精品国产一区二区三区色欲| 91精品国产福利在线导航| 国产精品亚洲精品| 91热成人精品国产免费|