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

                微信公眾平臺開發接口將不再支持多圖文。 官方消息如下: > 微信公眾平臺對多圖文消息類型進行了調整。從2018年10月12日起,被動回復消息與客服消息接口的圖文消息類型中圖文數目只能為一條,請知悉。 微信團隊 2018年09月30日 根據這一規則,本書中涉及回復多圖文消息的SDK需要進行修改,**只需要修改消息類型和客服接口的2個SDK**,其他地方均保持不動,修改方法如下。 1、被動回復圖文消息的修改 在回復圖文消息的時候,檢查圖文是單圖文還是多圖文,如果是多圖文,則轉換為文字進行回復,如果多圖文中有鏈接,則做成A標簽。如果是單圖文則保持不變。代碼如下 ``` //回復圖文消息 private function transmitNews($object, $newsArray) { if(!is_array($newsArray)){ return ""; } //多圖文轉文本回復 if (count($newsArray) > 1){ $content = ""; foreach ($newsArray as &$item) { $content .= "\n\n".(empty($item["Url"]) ? $item["Title"] : "<a href='".$item["Url"]."'>".$item["Title"]."</a>"); } $result = $this->transmitText($object, trim($content)); return $result; } $itemTpl = " <item> <Title><![CDATA[%s]]></Title> <Description><![CDATA[%s]]></Description> <PicUrl><![CDATA[%s]]></PicUrl> <Url><![CDATA[%s]]></Url> </item> "; $item_str = ""; foreach ($newsArray as $item){ $item_str .= sprintf($itemTpl, $item['Title'], $item['Description'], $item['PicUrl'], $item['Url']); } $xmlTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[news]]></MsgType> <ArticleCount>%s</ArticleCount> <Articles> $item_str </Articles> </xml>"; $result = sprintf($xmlTpl, $object->FromUserName, $object->ToUserName, time(), count($newsArray)); return $result; } ``` 2、客服消息的修改方法 思路和上述一樣,將多圖文轉為文字或A標簽。 代碼如下 ``` public function send_custom_message($touser, $type, $data) { $msg = array('touser' =>$touser); $msg['msgtype'] = $type; switch($type) { case 'text': $msg[$type] = array('content'=>urlencode($data)); break; case 'news': if (count($data) == 1){ $data2 = array(); foreach ($data as &$item) { $item2 = array(); foreach ($item as $k => $v) { $item2[strtolower($k)] = urlencode($v); } $data2[] = $item2; } $msg[$type] = array('articles'=>$data2); }else{ //多圖文轉文本 $content = ""; foreach ($data as &$item) { $url = isset($item["url"]) ? $item["url"] : $item["Url"]; $title = isset($item["title"]) ? $item["title"]:$item["Title"]; $content .= "\n\n".(empty($url) ? $title : "<a href='".$url."'>".$title."</a>"); } $msg['msgtype'] = 'text'; $msg['text'] = array('content'=>urlencode(trim($content))); } break; case 'music': case 'image': case 'voice': case 'video': case 'wxcard': $msg[$type] = $data; break; default: $msg['text'] = array('content'=>urlencode("不支持的消息類型 ".$type)); break; } $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".$this->access_token; return $this->http_request($url, urldecode(json_encode($msg))); } ```
                  <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>

                              哎呀哎呀视频在线观看