<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                1.在微信公眾平臺后臺找到網頁授權獲取用戶基本信息接口,點擊后面的修改 ![](https://box.kancloud.cn/2ccebe7d939f76321f9b9088c95a9b6a_1142x101.png) 2.填寫已經備案的項目域名,若域名符合條件,按確定會出現通過安全監測字樣 ![](https://box.kancloud.cn/b7aa8c119cad3d953769a488612dc6ff_583x438.png) ![](https://box.kancloud.cn/871dac68495e43ccf509f56f36c1fb87_722x119.png) 3.在微信公眾平臺后臺》開發者工具下面下載web開發者工具 ![](https://box.kancloud.cn/5d9f1bd08acfea36c5d46ef2166c51da_1128x510.png) 4.打開下載好的微信web開發者工具,選擇項目為“公眾號網頁測試”,并用微信登錄 ![](https://box.kancloud.cn/8d589fa9bfb464b9e8d86c4fdaf743ae_1022x756.png) 5.在項目根目錄下的/Application/Home/Controller文件夾中的IndexController.class.php文件,書寫代碼 ~~~ <?php namespace Home\Controller; use Think\Controller; use Com\Wechat; use Com\WechatAuth; class IndexController extends Controller { public function index(){ $token="zhangyouwu"; /* 加載微信 */ $wechat = new Wechat($token); /* 獲取請求信息 */ $data = $wechat->request(); if($data && is_array($data)){ switch($data['MsgType']){ case "text": $this->Text($wechat,$data); } } } //回復文本消息 private function Text($wechat,$data){ //回復文本消息 if(strstr($data['Content'],"文本")){ $text="我正在使用Thinkphp開發微信"; $this->logger("發送信息:\n".$text); $wechat-> replyText($text); }else if(strstr($data['Content'],"myself")){ $this->users($wechat,$data); } } //獲取用戶信息 private function users($wechat,$data){ $openid=$data['FromUserName']; $appid="wx165112bf167af76c"; $appSecret="c65b22bfcf03fdd98504eac299701b03"; $token=session('token'); if($token){ $WechatAuth=new WechatAuth($appid,$appSecret,$token); }else{ $WechatAuth=new WechatAuth($appid,$appSecret); $accsseToken=$WechatAuth->getAccessToken(); $token=$accsseToken['access_token']; session('token',$token); } $user=$WechatAuth->userInfo($openid); $text="你的openid是:".$user['openid']."\n你的昵稱是:".$user['nickname']."\n你的性別是:".$user['sex']."\n你的城市是:" .$user['city']."\n你所在的國家是:".$user['country']."\n你所在的省份是:".$user['province']; $this->logger("發送用戶的信息:\n".$text); $wechat->replyText($text); } //網頁授權獲取用戶基本信息 public function webUsers(){ $appid="wx165112bf167af76c"; $appSecret="c65b22bfcf03fdd98504eac299701b03"; $WechatAuth=new WechatAuth($appid,$appSecret); if($_GET['iscode']){ $url="http://zyw.xxxxx.com/index.php/Home/Index/webUsers";//zyw.xxxxx.com為微信公眾平臺的授權回調頁面域名 $result=$WechatAuth->getRequestCodeURL($url); echo $result; } /* $user=$WechatAuth->userInfo($openid); $text="你的openid是:".$user['openid']."\n你的昵稱是:".$user['nickname']."\n你的性別是:".$user['sex']."\n你的城市是:" .$user['city']."\n你所在的國家是:".$user['country']."\n你所在的省份是:".$user['province']; $this->logger("發送用戶的信息:\n".$text); $wechat->replyText($text);*/ } //日志 private function logger($content){//存儲日志 $logSize=100000;//定義日志大小 $log="log.txt";//定義日志名字 if(file_exists($log)&&filesize($log)>$logSize){//如果日志存在并且大于定義的大小 unlink($log);//刪除 } //文件寫入1.名字2.內容,+時間防止重復3.內容往后加而不是覆蓋 file_put_contents($log,date('H:i:s')." ".$content."\n",FILE_APPEND); } } ~~~ 6.在微信web開發工具填寫地址,得到下面展示即可 ![](https://box.kancloud.cn/ee722213c9a3b159912a5142d4946ac7_993x706.png) 7.本節源碼下載(下載密碼:yi84) [源碼下載](https://pan.baidu.com/s/12ZAi9C5jgZ2an3kR8y5aAA)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看