超碰中文网,91久久精品日日躁夜夜躁欧美,一区二区三区精品道,一区二区国产在线观看,亚洲精品中文字幕乱码一区二区,天天看片高清影视在线观看,久久99精品久久久久蜜桃,久久成人影视

VPS參考測評推薦
專注分享VPS主機優惠信息
衡天云優惠活動
熱網互聯2026年促銷活動
hostkvm優惠促銷活動
zji優惠促銷活動
QQGNET優惠促銷活動
QQGNET優惠促銷活動

微信api接口(微信API接口地址)

主機參考:VPS測評參考推薦/專注分享VPS服務器優惠信息!若您是商家可以在本站進行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務,查看詳情!
我們發布的部分優惠活動文章可能存在時效性,購買時建議在本站搜索商家名稱可查看相關文章充分了解該商家!若非中文頁面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作

本文介紹的內容是關于微信API接口的,有一定的參考價值。現在分享給大家,有需要的朋友可以參考一下。

本文介紹個人總結的一些微信API接口,包括微信支付、微信紅包、微信卡券、微信商店等。,這些都很全面,有需要的朋友可以參考一下。

微信入口綁定、微信事件處理、微信API的所有操作都包含在這些文件中。微信支付,微信紅包,微信卡券,微信商店。

1.[code ]index.php

lt馬鞭phpinclude _ once # 39lib . Inc . PHP # 39;;$wcObj =新微信( 游奎元 );$ WCO bj - gt;wcValid();2.【代碼】微信門戶類

lt馬鞭php/** *微信描述* * @作者管理員*/類微信擴展WxApi { public $ token = ";//將您的代碼放在這里public function _ _ construct($ token = ;"){ parent::_ _ construct();$ this - gt;token = $ token}公共函數wcCheckSignature(){ try { if(empty($ this - gt;token)) {拋出新的異常( # 39;令牌未定義!');} $ signature = $ _ GET[ ;簽名 ];$ timest = $ _ GET[ ;時間戳 ];$ nonce = $ _ GET[ ;nonce ];$ token = $ this - gt;token$tmpArr = array($token,$timest,$ nonce);//使用SORT_STRING規則排序($tmpArr,SORT _ STRING);$tmpStr =內爆($ TM parr);$ tmp str = sha1($ tmp str);if($ tmpStr = = $ signature){ return true;}else{返回false} } catch(異常$ e){ echo # 39;消息: # 39;。$ E->;getMessage();} }公共函數wcValid(){ $ echoStr = isset($ _ GET[ ;echostr ]) ; !empty($ _ GET[ ;echostr ]) ?add slashes($ _ GET[ ;echostr ]):NULL;if(is _ null($ echoStr)){ $ this - gt;wcMsg();} else {//有效簽名,option if($ this - gt;wcCheckSignature()){ echo $ echoStr;退出;} else { exit();} } }公共函數wcMsg(){//獲取post數據,可能是由于環境不同$ postStr = isset($ GLOBALS[ ;HTTP _ RAW _ POST _ DATA ]) ; !空($GLOBALS[ ;HTTP _ RAW _ POST _ DATA ]) ?$ GLOBALS[ ;HTTP _ RAW _ POST _ DATA ]: ;";如果(!empty($ postStr)){ libxml _ disable _ entity _ loader(true);$ post obj = SimpleXML _ load _ string($ postStr, # 39;SimpleXMLElement # 39,LIBXML _ NOCDATA);$ this - gt;zcLog(TRUE,$ post obj);$ from username = $ postobj - gt;from用戶名;$ touser name = $ postobj - gt;ToUserName$ MsgType = $ postobj - gt;MsgTypeif($ MsgType = = # 39;事件 # 39;){//執行$ event = $ postobj->對應的事件;事件;開關($ Event){ case # 39;訂閱 # 39;://注意破;案例 # 39;退訂 # 39;://unfollow break;案例 # 39;掃描 # 39;://掃描中斷;案例 # 39;位置 # 39;://地址中斷;案例 # 39;點擊 # 39;://點擊時間休息;案例 # 39;查看 # 39;://跳轉中斷;案例 # 39;卡_通行證_支票 # 39;://卡券通過了斷檔;案例 # 39;card _ not _ pass _ check # 39://卡片憑證審核中斷失敗;案例 # 39;user _ get _ card # 39://用戶獲得卡券折;案例 # 39;user _ del _ card # 39://用戶刪除卡券折;案例 # 39;user _ view _ card # 39://用戶瀏覽會員卡休息;案例 # 39;user _ consume _ card # 39://用戶注銷卡憑證斷;案例 # 39;merchant _ order # 39://微店用戶下單付款中斷;默認:break} } else { switch($ MsgType){ case # 39;正文 # 39;://文本格式中斷;案例 # 39;圖像 # 39;://圖片格式中斷;案例 # 39;聲音 # 39;://音斷;案例 # 39;視頻 # 39;://視頻中斷;案例 # 39;短視頻 # 39;://小視頻休息;案例 # 39;位置 # 39;://上傳地理位置break案例 # 39;鏈接 # 39;://鏈接相應的break默認:break} }///////////////////////////////////////////////////$ keyword = trim($postobj - gt;內容);$ time = time();$ textTpl = ltxml gt ltToUserName gt lt![CDATA[% s]] gt; lt/touser name gt; ltfrom用戶名 gt lt![CDATA[% s]] gt; lt/from username gt; ltCreateTime gt% s lt/create time gt; ltMsgType gt lt![CDATA[% s]] gt; lt/msg type gt; lt內容 gt lt![CDATA[% s]] gt; lt/Content gt; ltFuncFlag gt0 lt/func flag gt; lt/XML gt;";如果(!empty($ keyword)){ $ msgType = ;文本 ;$ contentStr = 歡迎來到微信世界!";$resultStr = sprintf($textTpl,$fromUsername,$toUsername,$time,$msgType,$ contentStr);echo $ resultStr} else { echo 輸入一些東西...";}///////////////////////////////////////////////////////{ else { echo ;暫時沒有信息!";退出;}}//log公共函數ZC日志($ errcode,$ errmsg){ $ this ->;returny = array();$ this - gt;退貨[ # 39;錯誤代碼 # 39;]= $ errcode;$ this - gt;退貨[ # 39;errmsg # 39]= $ errmsg;$ this - gt;退貨[ # 39;errtime # 39] =日期( y-m-d H:I:s ;,time());$ log file = fopen( ;日志文件_ 。日期( Ymd ,時間())。"。txt , a+ ;);$ txt = JSON _ encode($ this - gt;退貨)。"\ n ;fwrite($logfile,$ txt);fclose($ log file);//return $ this - gt;退貨;} }3.【代碼】微信運營類-更新了自定義菜單部分。

lt馬鞭PHP/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *作者Kyler You ltQQ:2444756311 gt;* @鏈接http://mp.weixin.qq.com/wiki/home/index.html * @ 2 . 0 . 1版* @使用$ wx API = new wx API();* @包微信API接口會陸續持續更新* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;;//const app secret = ;";const appId = ";const appSecret = ";//const MC hid = ;";//商戶號//const private key = " ;;//私鑰public $ parameters = array();public _ _ construct(){ }/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *。 * * * *返回微信上指定的JSON * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */public function WxHttpRequest($ URL,* curl_setopt($curl,CURLOPT_URL,$ URL); curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE);curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,FALSE);如果(!empty($ data)){ curl _ setopt($ curl,CURLOPT_POST,1);curl_setopt($curl,CURLOPT_POSTFIELDS,$ data);} curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);$ output = curl _ exec($ curl);curl _ close($ curl);返回$ output}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信帶證書提交數據-微信紅包使用* * * *公共函數wxHttpsRequestPem($url,$vars,$second=30,$ a header = array()){ $ ch = curl _ init();//timeout curl _ setopt ($ ch,curl opt _ timeout,$ second);curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//在這里設置代理,如果有的話//curl _ setopt ($ ch,curl opt _ proxy, # 39;10.206.30.98');//curl_setopt($ch,CURLOPT_PROXYPORT,8080);curl_setopt($ch,CURLOPT_URL,$ URL);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);//需要選擇以下兩種方法中的一種。//第一個方法,cert和key屬于兩個。pem文件。//默認格式為PEM,curl _ setopt ($ ch,curl opt _ sslcerttype, # 39;PEM # 39);curl_setopt($ch,CURLOPT_SSLCERT,getcwd()。'/API client _ cert . PEM # 39;);//默認格式為PEM,curl _ setopt ($ ch,curl opt _ sslkeytype, # 39;PEM # 39);curl_setopt($ch,CURLOPT_SSLKEY,getcwd()。'/API client _ key . PEM # 39;);curl_setopt($ch,CURLOPT_CAINFO, # 39;PEM # 39);curl_setopt($ch,CURLOPT_CAINFO,getcwd()。'/rootca . PEM # 39;);//第二種方式,兩個文件合二為一。pem文件//curl _ setopt ($ ch,curl opt _ sslcert,getcwd()。# 39;/all . PEM # 39;);if( count($aHeader)>= 1 ){ curl_setopt($ch,CURLOPT_HTTPHEADER,$ a header);} curl_setopt($ch,CURLOPT_POST,1);curl_setopt($ch,CURLOPT_POSTFIELDS,$ vars);$ data = curl _ exec($ ch);if($ data){ curl _ close($ ch);返回$ data} else { $ error = curl _ errno($ ch);回聲 調用失敗,錯誤代碼:$ error \ n ;curl _ close($ ch);返回false} }/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */公共函數wxAccessToken($appId = NULL,$ app secret = NULL){ $ appId = is _ NULL($ appId)?self::appId:$ appId;$appSecret = is_null($appSecret)?self::app secret:$ app secret;$ data = JSON _ decode(file _ get _ contents( ;access _ token.json ));if($data - gt;expire _ time lttime()) { //echo $appId,$ appSecret$ url = https://api.weixin.qq.com/cgi-bin/token?格蘭特類型=客戶證書 appid = 。$appId。" secret = 。$ appSecret$ result = $ this - gt;wxHttpsRequest($ URL);//print _ r($ result);$jsoninfo = json_decode($result,true);$ access _ token = $ JSON info[ ;訪問令牌 ];if($ access _ token){ $ data - gt;expire _ time = time()+7000;$data->access _ token = $ access _ token$ FP = fopen( ;access _ token.json , w );fwrite($fp,JSON _ encode($ data));fclose($ FP);} } else { $ access _ token = $ data - gt;access _ token} return $ access _ token}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */公共函數wxjsapitticket($ appId = NULL,$ app secret = NULL){ $ appId = is _ NULL($ appId)?self::appId:$ appId;$appSecret = is_null($appSecret)?self::app secret:$ app secret;$ data = JSON _ decode(file _ get _ contents( ;jsapi _ ticket.json ));if($data - gt;expire _ time lttime()){ $ URL = ;https://api.weixin.qq.com/cgi-bin/ticket/getticket?類型= jsapi access _ token = 。$ this - gt;wxAccessToken();$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);$ ticket = $ JSON info[ # 39;門票 # 39;];if($ ticket){ $ data - gt;expire _ time = time()+7000;$data->jsapi _ ticket = $ ticket$ FP = fopen( ;jsapi _ ticket.json , w );fwrite($fp,JSON _ encode($ data));fclose($ FP);} } else { $ ticket = $ data - gt;jsapi _ ticket} return $ ticket}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信通過OPENID獲取用戶信息, 返回數組* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */public function WX GetUser($ OpenID){ wxAccessToken(); $ url = https://api.weixin.qq.com/cgi-bin/user/info?訪問令牌= 。$wxAccessToken。" openid = 。$openId。" lang = zh _ CN ;$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *公共函數wxqr code ticket($ JSON data){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://api.weixin.qq.com/cgi-bin/qrcode/create?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($url,$ JSON data);返回$ result}公共函數wxqr code($ ticket){ $ URL = ;https://mp.weixin.qq.com/cgi-bin/showqrcode?機票= 。urlencode($ ticket);返回$ url}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *公共函數wxSetSend($touser,$template_id,$url,$data,$ topcolor = # 39# 7B68EE # 39){ $ template = array( # 39;touser # 39= gt$touser, # 39;template _ id # 39= gt$template_id, # 39;網址 # 39;= gt$url, # 39;topcolor # 39= gt$topcolor, # 39;數據 # 39;= gt$ data);$ JSON data = JSON _ encode($ template);$ result = $ this - gt;wxSendTemplate($ JSON data);返回$ result}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信設置OAUTH跳轉URL并返回字符串信息-。您只能獲得OpenID * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */public function WXOAUTHBase($ redirection ;,$ appId = NULL){ $ appId = is _ NULL($ appId)?self::appId:$ appId;$ url = https://open.weixin.qq.com/connect/oauth2/authorize? appid = ;。$appId。" redirect _ uri = 。$redirectUrl。" 代碼 scope = snsapi _ base state = 。$州。"#微信_重定向 ;返回$ url}返回字符串信息- SCOPE = snsapi_userinfo //獲取用戶的完整信息* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;,$ appId = NULL){ $ appId = is _ NULL($ appId)?self::appId:$ appId;$ url = https://open.weixin.qq.com/connect/oauth2/authorize? appid = ;。$appId。" redirect _ uri = 。$redirectUrl。" 代碼 scope = snsapi _ userinfo state = 。$州。"#微信_重定向 ;返回$ url}地點: 。$ URL);}公共函數wxOauthAccessToken($code,$appId = NULL,$ app secret = NULL){ $ appId = is _ NULL($ appId)?self::appId:$ appId;$appSecret = is_null($appSecret)?self::app secret:$ app secret;$ url = https://api.weixin.qq.com/sns/oauth2/access_token? appid = ;。$appId。" secret = 。$appSecret。" code = 。$code。" grant _ type = authorization _ code ;$ result = $ this - gt;wxHttpsRequest($ URL);//print _ r($ result);$jsoninfo = json_decode($result,true);//$ access _ token = $ JSON info[ ;訪問令牌 ];返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */公共函數wxOauthUser($OauthAT,$ openId){ $ URL = ;https://api.weixin.qq.com/sns/userinfo?訪問令牌= 。$OauthAT。" openid = 。$openId。" lang = zh _ CN ;$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *創建自定義菜單公共函數wxMenuCreate($ JSON data){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://api.weixin.qq.com/cgi-bin/menu/create?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($url,$ JSON data);$jsoninfo = json_decode($result,true);返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *公共函數wx menuget(){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://api.weixin.qq.com/cgi-bin/menu/get?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *刪除自定義菜單公共函數wxmenu Delete(){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://api.weixin.qq.com/cgi-bin/menu/delete?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *公共函數wxMenuGetInfo(){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://API . weixin . QQ . com/CGI -bin/get _ current _ self menu _ info?access _ token = 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);返回$ jsoninfo} *********/公共函數wxnon centr($ length = 16,$ type = FALSE){ $ chars = ;abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz 0123456789 ;;$ str = ";for($ I = 0;$ i lt$長度;$i++) { $str。= substr($chars,mt_rand(0,strlen($chars) - 1),1);} if($ type = = TRUE){ return strto upper(MD5(time()。$ str));} else { return $ str} ***************/公共函數wxMchBillno($ MC hid = NULL){ if(is _ NULL($ MC hid)){ if(self::MC hid = = ;"| | is _ null(self::MC hid)){ $ MC hid = time();} else { $ MC hid = self::MC hid;} } else { $ MC hid = substr(add slashes($ MC hid),0,10);}返回日期( Ymd ,時間())。時間()。$ mchid} *************/公共函數wxSetParam($ parameters){ if(is _ array($ parameters) ; !empty($ parameters)){ $ this - gt;parameters = $ parametersreturn $ this - gt;參數;} else{返回數組();} * * * * * * * * * * * * * * * * * * */公共函數wxFormatArray($parameters = NULL,$ urlencode = FALSE){ if(is _ NULL($ parameters)){ $ parameters = $ this - gt;參數;} $ restr = ";//初始化一個空ksort($ parameters);//排序參數foreach($ parameters as $ k = > >;$v){//循環定制參數if (null!= $ v "null != $ v "簽名 != $k) {if($urlencode){//如果參數需要增加URL加密,就會增加;如果沒有,就不需要$ v = urlencode($ v);} $restr。= $ k。 ;= 。v . ";//返回完整的字符串}} if (strlen ($ restr) >: 0) {//如果有數據,最后的“”Delete $ restr = substr($ restr,0,strlen($ restr)-1);} return $ restr//Return string }/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信MD5 * * * * * * * * * * * * * * * * * * * * * * * * * *公共函數wxMd5Sign($content,$ private key){ try { if(is _ null($ private key)){ throw new Exception( ;財付通簽名密鑰不能為空!");} if (is_null($content)) {拋出新異常( 財付通簽名內容不能為空”);} $signStr = $content。" key = 。$ privatekey返回strto upper(MD5($ signStr));} catch(異常$ e){ die($ E- gt;getMessage());} }/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信Sha1簽名生成器-* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */公共函數wxsha1 sign($content){ try { if(is _ null($content)){ throw new Exception( ;簽名內容不能為空”);}///$ signStr = $ content;返回sha1($ content);} catch(異常$ e){ die($ E- gt;getMessage());} }/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信jsApi集成方法-* * * * * * * * * * * * * * * * * * * * * * */公共函數wxjsapi package(){ $ jsApi _ ticket = $ this - gt;wxjsapi ticket();//注意,URL必須動態獲取,不能硬編碼。$protocol =(!空($ _ SERVER[ # 39;HTTPS # 39;]) ; $ _服務器[ # 39;HTTPS # 39;] !== '關 # 39;| | $ _服務器[ # 39;服務器端口 # 39;] == 443) ?"https:// ;: http:// ;;$url = $protocol。$ _ SERVER[ ;HTTP _ HOST ].$ _ SERVER[ ;請求_ URI ;];$ timest = time();$ non centr = $ this - gt;wxNonceStr();$ sign package = array( ;jsapi _ ticket = gt$jsapi_ticket, 非中心 = gt$ nonceStr, 時間戳 = gt$timest, url = gt$ URL);//這里參數的順序要按照鍵值$ raw string = " jsapi _ ticket = $ jsapi _ ticket ;noncestr = $ nonceStr 時間戳= $時間戳 url = $ url ;//$ raw string = $ this - gt;wx format array($ sign package);$ signature = $ this - gt;wx sha 1 sign($ raw string);$ sign package[ # 39;簽名 # 39;]= $ signature;$ sign package[ # 39;rawString # 39]= $ raw string;$ sign package[ # 39;appId # 39]= self::appId;返回$ signPackage}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */公共函數wxArrayToXml($parameters = NULL){ if(is _ NULL($parameters)){$parameters =$this - gt;參數;}如果(!is _ array($ parameters)| | empty($ parameters)){ die( ;參數不是數組,無法解析。);} $ xml = ltxml gt";foreach($ arr as $ key = gt;$ val){ if(is _ numeric($ val)){ $ XML。= lt"。$key。" gt"。$瓦爾。" lt/ ;。$key。" gt";} else $xml。= lt"。$key。" gt lt![CDATA[ ;。$瓦爾。"]] gt; lt/ ;。$key。" gt";} $xml。= lt/XML gt;";返回$ xml}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信卡券:上傳LOGO - *************/公共函數wxCardUpdateImg(){ $ wxAccessToken = $ this - gt;wxAccessToken();//$ data[ # 39;訪問令牌 # 39;]= $ wxAccessToken;$ data[ # 39;緩沖 # 39;] = '@ D:\ \ workspace \ \ htdocs \ \ yky _ test \ \ logo . jpg # 39;;$ url = https://api.weixin.qq.com/cgi-bin/media/uploadimg?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($url,$ data);$jsoninfo = json_decode($result,true);返回$ jsoninfo//array(1){[ ;url ]= gt;字符串(121) ;http://mm biz . qpic . cn/mm biz/ibuxphqexepntw 4 atkyias 1c F3 ztk iars 9 pfpz f1 k 5 icv xd 7 xw0k xuaxhdzked 9 micc mcn 0 ctjfw 6 tnm 93 mia afrq/0 ;} */public function wxCardColor(){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://api.weixin.qq.com/card/getcolors?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($ URL);$jsoninfo = json_decode($result,true);返回$ jsoninfo}公共函數wxCardCreated($ JSON data){ $ wxAccessToken = $ this - gt;wxAccessToken();$ url = https://api.weixin.qq.com/card/create?訪問令牌= 。$ wxAccessToken$ result = $ this - gt;wxHttpsRequest($url,$ JSON data);$jsoninfo = json_decode($result,true);返回$ jsoninfo}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *微信卡券:JSAPI卡券* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */公共函數wxCardPackage($ cardId){ $ timest = time();$ API _ ticket = $ this - gt;wxjsapi ticket();$ cardId = $ cardId$arrays = array($api_ticket,$timest,$ cardId);sort($ arrays);$string = sha1(內爆( ",$ arrays));$ result array[ # 39;card _ id # 39]= $ cardId;$ result array[ # 39;card _ ext # 39]= array();$ result array[ # 39;card _ ext # 39]['openid # 39] = 'oomn 4s 9 miwqhsnnvpn 0 dbtu 23 toa # 39;;$ result array[ # 39;card _ ext # 39]['時間戳 # 39;]= $ timest;$ result array[ # 39;card _ ext # 39]['簽名 # 39;]= $ string;返回$ resultArray} }4.【代碼】微信JSAPI

lt馬鞭php require _ once # 39lib . Inc . PHP # 39;;$ wx = new wx API();//獲取openid //if(!isset($ _ GET[ # 39;代碼 # 39;])){//header( ;位置:https://open . weixin . QQ . com/connect/oauth 2/authorize?appid = 。WxApi::appId。" redirect _ uri = http:// ;。$ _服務器[ # 39;服務器名稱 # 39;].$ _服務器[ # 39;PHP _ SELF # 39]." 代碼 scope = snsapi _ base state = 1 #微信_重定向 );//}//else {//$ CODE = $ _ GET[ # 39;代碼 # 39;];//$ Info = $ wx- gt;wxOauthAccessToken($ CODE);//print _ r($ Info);//$ openId = $ Info[ # 39;openid # 39];//}/////////////////////////////////////////$ sign package = $ wx- gt;wxjsapi package();//print _ r($ sign package);$ kqInfo = $ wx- gt;wxCardPackage( ;");$ listInfo = $ wx- gt;wxcardlist package();馬鞭 gt lthtml gt lthead gt lttitle gtJSAPI接口測試

$ kqinfo = array( ;卡片 = gtarray());$ kqinfo[ # 39;卡 # 39;]['卡_類型 # 39;] = '通用_優惠券 # 39;;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;] =數組( # 39;base _ info # 39= gtarray(), # 39;default _ detail # 39= gtarray());$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['logo _ url # 39] = '網址 # 39;;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['code _ type # 39] = 'CODE _ TYPE _ QRCODE # 39;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['brand _ name # 39] = '';$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['標題 # 39;] = '測試卡優惠券 # 39;;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['color # 39] = 'Color030 # 39;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['注意 # 39;] = '測試測試 # 39;;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['描述 # 39;] = '這是優惠券 # 39;;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['日期信息 # 39;]['類型 # 39;] = 1;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['日期信息 # 39;]['begin _ timest # 39]= time();$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['日期信息 # 39;]['end _ timest # 39]= time()+100 * 24 * 3600;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['base _ info # 39]['sku # 39]['數量 # 39;] = 100000;$ kqinfo[ # 39;卡 # 39;]['通用_優惠券 # 39;]['default _ detail # 39] = '測試數據\n測試數據\n測試數據 # 39;;//var _ dump($ kqinfo);//$ kqinfo = JSON _ encode($ kqinfo);$ kqinfo = C::en JSON($ kqinfo);//print _ r($ kqinfo);//$ result data = $ wx- gt;wxCardCreated($ kqinfo);相關建議:

php Restful api示例

以上是微信API接口的細節。更多請關注主機參考其他相關文章!

這幾篇文章你可能也喜歡:

本文由主機參考刊發,轉載請注明:微信api接口(微信API接口地址) http://m.k2270.com/80480.html

【騰訊云】領8888元采購禮包,搶爆款云服務器 每月 9元起,個人開發者加享折上折!
打賞
轉載請注明原文鏈接:主機參考 » 微信api接口(微信API接口地址)
主機參考僅做資料收集,不對商家任何信息及交易做信用擔保,購買前請注意風險,有交易糾紛請自行解決!請查閱:特別聲明

評論 搶沙發

評論前必須登錄!