本文介紹介紹微信公眾平台自定義菜單及高級接口的PHP SDK及使用方法。
方倍工作室
2014.05.03 v1.0
= "" = "" __construct( = , = ( ->appid = ( ->appsecret = ->lasttime = 1395049256 ->access_token = "nRZvVpDU7LxcSi7GnG2LrUcmKbAECzRf0NyDBwKlng4nMPf88d34pkzdNcvhqm4clidLGAS18cN1RTSK60p49zIZY4aO13sF-eqsCs0xjlbad-lKVskk8T7gALQ5dIrgXbQQ_TAesSasjJ210vIqTQ" (() > (->lasttime + 7200 = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".->appid."&secret=".-> = ->https_request( = json_decode(, ->access_token = ["access_token" ->lasttime = get_user_list( = = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=".->access_token."&next_openid=". = ->https_request( json_decode(, get_user_info( = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=".->access_token."&openid=".."&lang=zh_CN" = ->https_request( json_decode(, create_menu( = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".-> = ->https_request(, json_decode(, send_custom_message(, , = ('touser' => ( 'text': ['msgtype'] = 'text' ['text'] = ('content'=> ( = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=".-> ->https_request(, (json_encode( create_qrcode(, ( 'QR_LIMIT_SCENE': = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": '..'}}}' 'QR_SCENE': = '{"expire_seconds": 1800, "action_name": "QR_SCENE", "action_info": {"scene": {"scene_id": '..'}}}' = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=".-> = ->https_request(, = json_decode(, "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=".(["ticket" create_group( = '{"group": {"name": "'..'"}}' = "https://api.weixin.qq.com/cgi-bin/groups/create?access_token=".-> = ->https_request(, json_decode(, update_group(, = '{"openid":"'..'","to_groupid":'..'}' = "https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=".-> = ->https_request(, json_decode(, upload_media(, = ("media" => "@".().'\\'. = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=".->access_token."&type=". = ->https_request(, json_decode(, https_request(, = = curl_setopt(, CURLOPT_URL, curl_setopt(, CURLOPT_SSL_VERIFYPEER, curl_setopt(, CURLOPT_SSL_VERIFYHOST, (!( curl_setopt(, CURLOPT_POST, 1 curl_setopt(, CURLOPT_POSTFIELDS, curl_setopt(, CURLOPT_RETURNTRANSFER, 1 = curl_exec( curl_close( }
初始化對象
= class_weixin_adv("wx6222221b11111111", "3079cb22ad383ae7371d12aed1b2d0cc");
查看Access Token
(->access_token);
創建二維碼
(->create_qrcode("QR_SCENE", "134324234"));
獲取關注者列表
(->get_user_list());
獲取用戶信息
= "oLVPpjkttuZTbwDwN7vjHNlqsmPs"(->get_user_info());
創建菜單
='{"button":[{"name":"方倍工作室","sub_button":[{"type":"click","name":"公司簡介","key":"公司簡介"},{"type":"click","name":"社會責任","key":"社會責任"},{"type":"click","name":"聯系我們","key":"聯系我們"}]},{"name":"產品服務","sub_button":[{"type":"click","name":"微信平台","key":"微信平台"},{"type":"click","name":"微博應用","key":"微博應用"},{"type":"click","name":"手機網站","key":"手機網站"}]},{"name":"技術支持","sub_button":[{"type":"click","name":"文檔下載","key":"文檔下載"},{"type":"click","name":"技術社區","key":"技術社區"},{"type":"click","name":"服務熱線","key":"服務熱線"}]}]}'(->create_menu());
用戶分組
(->create_group("老師"(->update_group(, "100"));
上傳下載多媒體
(->upload_media("image","pondbay.jpg"));
發送客服消息
(->send_custom_message(, "text", "asdf"));
=========================================================
方倍工作室微信公眾平台賬號關注方法:
1. 微信通訊錄-添加朋友-查找公眾號-搜索“方倍工作室”
2. 微信通訊錄-添加朋友-搜號碼-輸入“pondbaystudio”
3. 使用微信掃描下面的二維碼