微信單圖文、多圖文推送、清單中排序
<?php /** * @author yinhuiying(改于) * @since version - 2014-10-31 * @deprecated version - 2014-10-31 * 腾讯客服接口 */ class ServiceModel extends Model{ /** * 客服接口(高级接口) * @param int $uid * @param String openid 微信唯一标识 * @param String array 回复数组内容 * @param int type 类型 1表示文字回复 2表示图文回复 * */ public function Service($openid,$array,$type){ switch($type){ case 1: $json = '{ "touser":"'.strval($openid).'", "msgtype":"text", "text": { "content":"'.$array['content'].'" } }'; $this->postService($json); break; case 2: $json = '{ "touser":"OPENID", "msgtype":"image", "image": { "media_id":"MEDIA_ID" } }'; $this->postService($json); break; case 3: $json = '{ "touser":"OPENID", "msgtype":"voice", "voice": { "media_id":"MEDIA_ID" } }'; $this->postService($json); break; case 4: $json = '{ "touser":"OPENID", "msgtype":"video", "video": { "media_id":"MEDIA_ID", "title":"TITLE", "description":"DESCRIPTION" } }'; $this->postService($json); break; case 5: $json = '{ "touser":"OPENID", "msgtype":"music", "music": { "title":"MUSIC_TITLE", "description":"MUSIC_DESCRIPTION", "musicurl":"MUSIC_URL", "hqmusicurl":"HQ_MUSIC_URL", "thumb_media_id":"THUMB_MEDIA_ID" } }'; $this->postService($json); break; case 6: $json = '{ "touser":"OPENID", "msgtype":"news", "news":{ "articles": [ { "title":"'.$array['title1'].'", "description":"'.$array['description1'].'", "url":"'.$array['url1'].'", "picurl":"'.$array['picurl1'].'" }, { "title":"'.$array['title2'].'", "description":"'.$array['description2'].'", "url":"'.$array['url2'].'", "picurl":"'.$array['picurl2'].'" }, { "title":"'.$array['title3'].'", "description":"'.$array['description3'].'", "url":"'.$array['url3'].'", "picurl":"'.$array['picurl3'].'" } ] } }'; $this->postService($json); break; } } public function postService($json){ $access_token = model('WeixinInterface')->getACCESS_TOKEN(330); //Log :: write("客服接口获得的accessToken是".$access_token, log :: INFO); $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$access_token; model('WeixinInterface')->getHttpResponsePOST($url,$json); } } ?> ---------------或者--------------------- MODEL中 public function Service($uid,$json){ self::$wxInterFace = M('WXInterFace','wxmenu'); $access_token = $this->getACCESS_TOKEN($uid); $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$access_token; $this->getHttpResponsePOST($url,$json); } 在ACTION中 //图文回复 public function msgReturn(){ $json = '{ "touser":"'.strval($_SESSION['oauthopenid']).'", "msgtype":"news", "news":{ "articles": [ { "title":"大华双十一购房狂欢节,团购优惠等你来!", "description":"", "url":"http://dc.exweixin.com/index.php?app=Dhcheap&mod=Index&act=index&aid=11", "picurl":"http://dc.exweixin.com/data/upload/2014/1031/10/top_img_1.png" }, { "title":"一口价房源再享折上折", "description":"", "url":"http://dc.exweixin.com/index.php?app=RedPacket&mod=Coupon&act=welcome&uid=330", "picurl":"http://dc.exweixin.com/data/upload/2014/1031/10/fixed_1.jpg" }, { "title":"我要抢红包", "description":"", "url":"http://dc.exweixin.com/index.php?app=redPacket&mod=Welcome&act=welcome&uid=330", "picurl":"http://dc.exweixin.com/data/upload/2014/1031/10/rob_1.jpg" }, { "title":"土豪排行榜", "description":"", "url":"http://dc.exweixin.com/index.php?app=RedPacket&mod=Index&act=ranking", "picurl":"http://dc.exweixin.com/data/upload/2014/1031/10/ranking_1.jpg" }, { "title":"我的钱包", "description":"", "url":"http://dc.exweixin.com/index.php?app=RedPacket&mod=Index&act=person&openid='.strval($_SESSION['oauthopenid']).'", "picurl":"http://dc.exweixin.com/data/upload/2014/1031/10/packet_1.jpg" } ] } }'; //调用客服接口 $uid=330; M('CustomService','wxmenu')->Service($uid,$json); } //----------------------------------// 列表中排序、效果 1、 2、 3、 代码 <li class="count">{$i+$n}</li>
以上就是微信單圖文、多圖文推送、列表中排序的內容,更多相關內容請關注PHP中文網(www.php.cn)!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

H5、小程序和APP的主要區別在於:技術架構:H5基於網頁技術,小程序和APP為獨立應用程序。體驗和功能:H5輕便易用,功能受限;小程序輕量級,交互性好;APP功能強大,體驗流暢。兼容性:H5跨平台兼容,小程序和APP受平台限制。開發成本:H5開發成本低,小程序中等,APP最高。適用場景:H5適合信息展示,小程序適合輕量化應用,APP適合複雜功能應用。

本文提供國內安全下載歐易OKX App的詳細指南。由於國內應用商店限制,建議用戶通過歐易OKX官方網站下載App,或使用官網提供的二維碼掃描下載。下載過程中,務必核實官網地址,檢查應用權限,安裝後進行安全掃描,並啟用雙重驗證。 使用過程中,請遵守當地法律法規,使用安全網絡環境,保護賬戶安全,警惕詐騙,理性投資。 本文僅供參考,不構成投資建議,數字資產交易風險自負。

公司安全軟件與應用兼容性問題及排查方法許多企業為了保障內網安全,會安裝安全軟件。然而,安全軟件有時...

公司安全軟件導致部分應用無法正常運行的排查與解決方法許多公司為了保障內部網絡安全,會部署安全軟件。 ...

H5和小程序的選擇取決於需求。對於跨平台、快速開發和高擴展性的應用,選擇H5;對於原生體驗、豐富功能和平台依附性的應用,選擇小程序。

本文提供2025年更新的幣安虛擬貨幣買賣簡明指南,詳細講解了在幣安平台上進行虛擬貨幣交易的操作步驟。指南涵蓋了法幣購買USDT、幣幣交易購買其他幣種(如BTC)以及賣出操作,包括市價交易和限價交易兩種方式。 此外,指南還特別提示了法幣交易的支付安全和網絡選擇等關鍵風險,幫助用戶安全、高效地進行幣安交易。 通過本文,您可以快速掌握在幣安平台上買賣虛擬貨幣的技巧,降低交易風險。
