WeChat ?? ??? ??? ???? ??? ?? ?? API? ??????. ? ????? WeChat ?? ??? ??? ?? ?? ??? ???? ?? C#? ??????. ?? ???? ?? ??? ??? ?? ?? ??? ??? ? ????
?? ?? ??? ??? ????.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="cm.aspx.cs" Inherits="guotaotao_weixin.cm" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> ????<title>test</title> </head> <body> ????<form id="form1" runat="server"> ????<p> ?????<asp:Literal ID="lt_msg" runat="server" ></asp:Literal> ????</p> ????</form> </body> </html>
?? ?? ??? ??? ????.
using?System; using?System.Collections; using?System.Configuration; using?System.Data; using?System.Linq; using?System.Web; using?System.Web.Security; using?System.Web.UI; using?System.Web.UI.HtmlControls; using?System.Web.UI.WebControls; using?System.Web.UI.WebControls.WebParts; using?System.Xml.Linq; namespace?guotaotao_weixin { ????public?partial?class?cm?:?System.Web.UI.Page ????{ ????????protected?void?Page_Load(object?sender,?EventArgs?e) ????????{ ????????????if?(!IsPostBack) ????????????{ ????????????????weixin?wx?=?new?weixin(); ????????????????//lt_msg.Text?=?wx.GetAccessToken(); ????????????????lt_msg.Text?=?wx.DelMenu(); ????????????????lt_msg.Text?+=?wx.SetMenu(); ????????????} ????????} ????} }
?? ????? ??? ????.
namespace?guotaotao_weixin?{ ???? ????public?partial?class?cm?{ ????????///?<summary> ????????///?form1?控件。 ????????///?</summary> ????????///?<remarks> ????????///?自動生成的字段。 ????????///?若要進行修改,請將字段聲明從設計器文件移到代碼隱藏文件。 ????????///?</remarks> ????????protected?global::System.Web.UI.HtmlControls.HtmlForm?form1; ????????///?<summary> ????????///?lt_msg?控件。 ????????///?</summary> ????????///?<remarks> ????????///?自動生成的字段。 ????????///?若要進行修改,請將字段聲明從設計器文件移到代碼隱藏文件。 ????????///?</remarks> ????????protected?global::System.Web.UI.WebControls.Literal?lt_msg; ????} }
?? ????? ??? ????.
using?System; using?System.Data; using?System.Configuration; using?System.Linq; using?System.Web; using?System.Web.Security; using?System.Web.UI; using?System.Web.UI.HtmlControls; using?System.Web.UI.WebControls; using?System.Web.UI.WebControls.WebParts; using?System.Xml.Linq; using?guotaotao_weixin.database; using?guotaotao.database; namespace?guotaotao_weixin { ????public?class?guotaotao ????{ ????????private?string?_content?=?""; ????????private?string?_FromUserName?=?""; ????????public?int?msgType?=?0; ????????public?int?isFirst?=?0; ????????public?int?pid?=?0; ????????#region?"構造函數(shù)" ????????????public?guotaotao() ????????????{ ????????????} ????????????public?guotaotao(string?content) ????????????{ ????????????????this._content?=?content; ????????????} ????????????public?guotaotao(string?content,string?FromUserName) ????????????{ ????????????????this._content?=?content; ????????????????this._FromUserName?=?FromUserName; ????????????} ????????#endregion ????????? ????????public?string?createMenuDate() ????????{ ????????????string?postData?=?"{"?+?"\r\n"; ????????????postData?+=?"\"button\":[?"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"\"name\":\"產品\","?+?"\r\n"; ????????????postData?+=?"\"sub_button\":["?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"click\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"無糖系列\(zhòng)",?"?+?"\r\n"; ????????????postData?+=?"???\"key\":\"gtt_menu_001001\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"click\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"干果系列\(zhòng)",?"?+?"\r\n"; ????????????postData?+=?"???\"key\":\"gtt_menu_001002\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"click\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"休閑系列\(zhòng)",?"?+?"\r\n"; ????????????postData?+=?"???\"key\":\"gtt_menu_001003\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"click\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"兒童系列\(zhòng)",?"?+?"\r\n"; ????????????postData?+=?"???\"key\":\"gtt_menu_001004\""?+?"\r\n"; ????????????postData?+=?"?}]"?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{"?+?"\r\n"; ????????????postData?+=?"\"name\":\"活動\",?"?+?"\r\n"; ????????????postData?+=?"\"sub_button\":["?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"click\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"抽獎\",?"?+?"\r\n"; ????????????postData?+=?"???\"key\":\"gtt_menu_002001\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"view\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"獲獎名單\",?"?+?"\r\n"; ????????????postData?+=?"???\"url\":\"http://www.aaa.com/apps/honor_list.aspx\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"click\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"優(yōu)惠券\",?"?+?"\r\n"; ????????????postData?+=?"???\"key\":\"gtt_menu_002003\""?+?"\r\n"; ????????????postData?+=?"?}]"?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{"?+?"\r\n"; ????????????postData?+=?"\"name\":\"幫助\","?+?"\r\n"; ????????????postData?+=?"\"sub_button\":["?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"view\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"關于我們\",?"?+?"\r\n"; ????????????postData?+=?"???\"url\":\"http://www.aaa.com/apps/aboutus.aspx\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"view\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"聯(lián)系我們\",?"?+?"\r\n"; ????????????postData?+=?"???\"url\":\"http://www.aaa.com/apps/contactus.aspx\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"view\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"查詢訂單\",?"?+?"\r\n"; ????????????postData?+=?"???\"url\":\"http://www.aaa.com/apps/orders_chaxun.aspx\""?+?"\r\n"; ????????????postData?+=?"},"?+?"\r\n"; ????????????postData?+=?"{?"?+?"\r\n"; ????????????postData?+=?"???\"type\":\"view\","?+?"\r\n"; ????????????postData?+=?"???\"name\":\"留言反饋\",?"?+?"\r\n"; ????????????postData?+=?"???\"url\":\"http://www.aaa.com/apps/feedback.aspx\""?+?"\r\n"; ????????????postData?+=?"?}]"?+?"\r\n"; ????????????postData?+=?"}]"?+?"\r\n"; ????????????postData?+=?"}"?+?"\r\n"; ????????????return?postData; ????????} ????} }
??? URL ?? ???
?? ?? ??? ??? ????.
using?System; using?System.Web.Security; using?System.Xml; using?aaa_weixin.database; using?Newtonsoft.Json; namespace?aaa_weixin { ????public?class?weixin ????{ ????????private?string?Token?=?"";?//微信里面開發(fā)者模式Token ????????private?string?devlopID?=?"";//微信里面開發(fā)者模式:開發(fā)者ID ????????private?string?devlogPsw?=?"";//微信里面開發(fā)者模式:?開發(fā)者密碼 ????????public?string?AccessToken?=?"";?//獲取的通行證 ????????public?void?Auth() ????????{ ????????????string?echoStr?=?System.Web.HttpContext.Current.Request.QueryString["echoStr"]; ????????????if?(CheckSignature()) ????????????{ ????????????????if?(!string.IsNullOrEmpty(echoStr)) ????????????????{ ????????????????????System.Web.HttpContext.Current.Response.Write(echoStr); ????????????????????System.Web.HttpContext.Current.Response.End(); ????????????????} ????????????} ????????} ????????public?string?GetAccessToken()?//獲取通行證 ????????{???????????? ????????????string?url_token?=?"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="?+?devlopID?+?"&secret="?+?devlogPsw; ????????????string?result?=?func.webRequestGet(url_token); ????????????accessToken?deserializedProduct?=?(accessToken)JsonConvert.DeserializeObject(result,?typeof(accessToken)); ????????????this.AccessToken??=?deserializedProduct.access_Token; ????????????return?this.AccessToken; ????????} ????????public?string?GetMenu()?//獲取當前菜單情況 ????????{ ????????????string?url_Menu_Get?=?"https://api.weixin.qq.com/cgi-bin/menu/get?access_token="?+?this.AccessToken; ????????????string?output?=?func.webRequestGet(url_Menu_Get); ????????????//wxErr?deserializedProduct?=?(wxErr)JsonConvert.DeserializeObject(output,?typeof(wxErr)); ????????????//return?deserializedProduct.errmsg; ????????????return?output; ????????} ????????public?string?SetMenu()?//設置最新菜單 ????????{ ????????????string?url_Menu_Create?=?"https://api.weixin.qq.com/cgi-bin/menu/create?access_token="?+?this.GetAccessToken(); ????????????aaa?gtt?=?new?aaa(); ????????????string?postData?=?gtt.createMenuDate(); ????????????string?result?=?func.webRequestPost(url_Menu_Create,postData); ????????????return?result; ????????} ????????public?string?DelMenu()?//刪除菜單 ????????{ ????????????string?url_Menu_Delete?=?"https://api.weixin.qq.com/cgi-bin/menu/delete?access_token="?+?this.GetAccessToken(); ????????????string?result?=?func.webRequestGet(url_Menu_Delete); ????????????return?result; ????????} ????????///?<summary> ????????///?驗證微信簽名 ????????///?</summary> ????????///?*?將token、timestamp、nonce三個參數(shù)進行字典序排序 ????????///?*?將三個參數(shù)字符串拼接成一個字符串進行sha1加密 ????????///?*?開發(fā)者獲得加密后的字符串可與signature對比,標識該請求來源于微信。 ????????///?<returns></returns> ????????private?bool?CheckSignature() ????????{ ????????????string?signature?=?System.Web.HttpContext.Current.Request.QueryString["signature"]; ????????????string?timestamp?=?System.Web.HttpContext.Current.Request.QueryString["timestamp"]; ????????????string?nonce?=?System.Web.HttpContext.Current.Request.QueryString["nonce"]; ????????????string[]?ArrTmp?=?{?Token,?timestamp,?nonce?}; ????????????Array.Sort(ArrTmp);?????//字典排序 ????????????string?tmpStr?=?string.Join("",?ArrTmp); ????????????tmpStr?=?FormsAuthentication.HashPasswordForStoringInConfigFile(tmpStr,?"SHA1"); ????????????tmpStr?=?tmpStr.ToLower(); ????????????if?(tmpStr?==?signature) ????????????{ ????????????????return?true; ????????????} ????????????else ????????????{ ????????????????return?false; ????????????} ????????} ????} ????public?class?wxErr ????{ ????????private?int?Errcode; ????????public?int?errcode ????????{ ????????????get?{?return?Errcode;?} ????????????set?{?Errcode?=?value;?} ????????} ????????private?string?Errmsg; ????????public?string?errmsg ????????{ ????????????get?{?return?Errmsg;?} ????????????set?{?Errmsg?=?value;?} ????????} ????} ????public?class?accessToken ????{ ????????private?string?access_token; ????????public?string?access_Token ????????{ ????????????get?{?return?access_token;?} ????????????set?{?access_token?=?value;?} ????????} ????????private?int?expires_in; ????????public?int?expires_In ????????{ ????????????get?{?return?expires_in;?} ????????????set?{?expires_in?=?value;?} ????????}? ????} ?}
? ??? C#? ???? ?? ??? ??? ?? ?? ?? ?? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!
? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??
?? ?? ?? ??? | Uma Musume Pretty Derby
1 ? ? ?
By Jack chen
<night> : ???? 99 ? - ?? ?? ? ?? ?? ??
1 ? ? ?
By DDD
?? ? ??? ????? Rimworld Odyssey ?? ???
3 ? ? ?
By Jack chen
Mejiro Ryan ?? ??? | Uma Musume Pretty Derby
4 ? ? ?
By Jack chen
Rimworld Odyssey ?? ??
3 ? ? ?
By Jack chen

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)