<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                1.微信token接入驗證 ~~~ protected function valid() { $echoStr = $_GET['echostr']; //通過GET方法獲取echostr的值 if ($this->checksSignature()) { echo $echoStr; //輸出echoStr exit; } } ~~~ 2.簽名 ~~~ protected function checksSignature() { //signature 是微信傳過來的 類似于簽名的東西 $signature = $_GET["signature"]; //微信發過來的東西 $timestamp = $_GET["timestamp"]; //微信傳過來的值 什么用我不知道... $nonce = $_GET["nonce"]; //定義你在微信公眾號開發者模式里面定義的token $token = "weixin"; //三個變量 按照字典排序 形成一個數組 $tmpArr = array( $token, $timestamp, $nonce ); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); //哈希加密 在laravel里面是Hash:: $tmpStr = sha1($tmpStr); //按照微信的套路 給你一個signature沒用是不可能的 這里就用得上了 if ($tmpStr == $signature) { return true; } else { return false; } } ~~~ 3.文本消息回復 ~~~ public function response_text($fromUsername, $toUsername) { $textTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <ArticleCount>%s</ArticleCount> %s </xml>"; $count=1; $str="<Articles> <item> <Title>< ![CDATA[壹城好店!] ]></Title> <Description>< ![CDATA[同城美食,家居,時尚,健身,教育.....咨詢平臺] ]></Description> <PicUrl>< ![CDATA[http://admin.nineopen.com:8000/uploads/banner/20180708/5bdd6e995e52d665c6486529c1bf8188.jpg] ]></PicUrl> <Url>< ![CDATA[http://www.nineopen.com] ]></Url> </item> </Articles>"; $msgType = "news"; $time =time(); $resultStr = sprintf($textTpl,$toUsername,$fromUsername, $time, $msgType,$count,$str); echo $resultStr; } ~~~ 4.通過菜單點擊事件獲取openid ~~~ protected function get_openid() { $postStr = file_get_contents('php://input'); libxml_disable_entity_loader(true); $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $MsgType =trim($postObj->MsgType); $FromUserName =trim($postObj->FromUserName); $ToUserName =trim($postObj->ToUserName); $Event =trim($postObj->Event); if ($MsgType == 'event' and $Event == 'subscribe') { return $FromUserName; } } ~~~ 5.創建菜單 ~~~ public function menu(){ $token =$this->gettoken(); $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token='.$token; $jsondata = array("button" => array(['type' => 'view', 'name' => '微商城', 'url' => 'https://tuan.nineopen.com'], ['type' => 'view', 'name' => '個人中心', 'url' => 'https://tuan.nineopen.com/personal'])); $data = json_encode($jsondata, JSON_UNESCAPED_UNICODE); $obj= $this->curl($url,$data); return $obj; } ~~~ 6.檢查菜單 ~~~ public function menucheck(){ $token =$this->gettoken(); $url = 'https://api.weixin.qq.com/cgi-bin/menu/get?access_token='.$token; $obj= $this->curl_get($url); return $obj; } ~~~
                  <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>

                              哎呀哎呀视频在线观看