Senparc.Weixin.MP SDK WeChat ?? ??? ?? ????(3): WeChat ?? ??? ?? ??
Feb 22, 2017 pm 03:34 PMWeChat ?? ???? "?? ??"? ?????, ? ??? ???? ????? ????? ????? ???? ???(Senparc.Weixin.MP SDK WeChat ?? ??? ?? ????(1): WeChat ??) ?? ??? ??), ?? ??? ???? ??? ??? ? ?? ??? "?? ??" ??? ?????.
"?? ??" > "?? ??"? ???? ?? ???? ???? ?? ?? 80(?? ?? ??? ?? ?? IP ???? ???)? ???? ???? ? ?? ????? ??? ???. ?? ??, ?? ??: Senparc.Weixin.MP SDK WeChat ?? ??? ?? ????(2): ??? ??
?? "?? ??"? ??? ? ?????? ??? ????.
"?? ??"? ????? ?? "?? ??"? ?? ???.
?? ??? ????? ?????. ??? ??:
??? ??? ????? ???? "?? ??"? ????.
?? ?? "?? ??"?? ???? ??? ?? "?? ??"? ?????.
Enter ?? ?? ????? WeChat ??? ???? Url? ?? ?? ??(?????? ? ??) Token? ???? ???.
???? PHP ?? ??? ??????: http://mp.weixin.qq.com/mpres/htmledition/res/wx_sample.zip ?? API ??? ?? ??? ??? ??? ?? ????. . ??.
Senparc.Weixin.MP? ?? ?? ??????? ?? ??? ? ?? ASP.NET MVC ? ASP.NET Web Forms?? ? ?? ??? ?????: https://github.com/JeffreySu /WeiXinMPSDK
?? ? WeChat ??? ??? ???? ??? URL? ?? Get ??? ??? ?????. ????? ???? ??? ??? ????. ???? ??? ?? ???? ????, ??? ??? ??? ? ????.
? URL? ???? ????? ?? ?? ??? ????? ??? ?? ????? ???? ?? ???? Senparc.Weixin.MP? ?? ??? ???????(?? MVC? WebForms? ?? ???????). :
?? 1: MVC ??
1. WeixinController.cs? ?? ????? ???? Senparc.Weixin.MP.dll(Senparc.Weixin.MP.dll ??)? ?????. ?? DLL? ??????. ?? ?? ????? Senparc.Weixin.MP.BuildOutPut ?? https://github.com/JeffreySu/WeiXinMPSDK/tree/master/Senparc.Weixin.MP.BuildOutPut
2. ?? ??? ?? ?? ??(?? ??????? ??? ?? ??):
public readonly string Token = "weixin";//與微信公眾賬號后臺的Token設置保持一致,區(qū)分大小寫。
3. Get ??? ?? Index?? ??? ?????. ?:
/// <summary> /// 微信后臺驗證地址(使用Get),微信后臺的“接口配置信息”的Url填寫如:http://ipnx.cn/ /// </summary> [HttpGet] [ActionName("Index")] public ActionResult Get(string signature, string timestamp, string nonce, string echostr) { if (CheckSignature.Check(signature, timestamp, nonce, Token)) { return Content(echostr); //返回隨機字符串則表示驗證通過 } else { return Content("failed:" + signature + "," + MP.CheckSignature.GetSignature(timestamp, nonce, Token)+"。如果您在瀏覽器中看到這條信息,表明此Url可以填入微信后臺。"); } }
? ???? ??? ??? ??? ?? ????? ????? ???? http://ipnx.cn? ?????. / "????? ?? ??"? ?? weixin? ?????.
? ??? ?? WeixinController.cs? ???? ?? ? ????.
?? 2: Web Forms ??
Web Forms? ?? ??? MVC? ????? ?? ??? ?? ????. ??? ??? ?? ?????(Senparc.Weixin? ??). .MP.dll), ?? ??? ?? ????? weixin.aspx?? ??:
public partial class Weixin : System.Web.UI.Page { private readonly string Token = "weixin";//與微信公眾賬號后臺的Token設置保持一致,區(qū)分大小寫。 protected void Page_Load(object sender, EventArgs e) { string signature = Request["signature"]; string timestamp = Request["timestamp"]; string nonce = Request["nonce"]; string echostr = Request["echostr"]; if (Request.HttpMethod == "GET") { //get method - 僅在微信后臺填寫URL驗證時觸發(fā) if (CheckSignature.Check(signature, timestamp, nonce, Token)) { WriteContent(echostr); //返回隨機字符串則表示驗證通過 } else { WriteContent("failed:" + signature + "," + CheckSignature.GetSignature(timestamp, nonce, Token)); } } else { //判斷Post或其他方式請求 } Response.End(); } private void WriteContent(string str) { Response.Output.Write(str); } }
? ??? ??? "????? ?? ??"? Url? http://YourDomain/weixin.aspx?, Token? weixin? ????? ???.
? weixin.aspx.cs? ?? ??? ??? ?????(?? ???? ?? ????? ?? ashx? ??? ?? ????).
CheckSignature.Check() ???? Senparc.Weixin.MP SDK?? ??? ???? ???? ????? ????. ??? ?? ???? ??? ??? ????? ?? ??? ???? ????. ?? ?? ???? ?? ??? ?? ? ? ????.
?? ? ?? ??? MVC? Web Forms ? ??? ???? ?? ????? ??? ??? ? ????. ??? Get ??????? WeChat ???? ?? ??? ??? ? ????. ?? ?????? WeChat ??? Url? Get ???? ?? ???? WeChat ?????? ??? Post ???? ?? ????? ?? ?? ?? ?????. Post ??? ???? ?? ?????? ??? ???????.
??? ?? ????? Post ?? ???? ?????? ??? ????? ?? ??? ?? WeChat ????? ???? ?? ? ??? ??? ????. ??? ??? ?????. "??? ??" ??:
?? ? WeChat ??? "??? ??"? ????? ???????. WeChat ?????? ? ?? ???? ?? ?? ???? ?????. ?? ??? URL? ?????.
?? ???? ?????? Post ??? ???? ?? ?? "????" ??? ???? ??? ???????.
"???? ??" ??? ??? ?, Senparc.Weixin.MP SDK? "???" "???" ??? ????? ?????.
? ?? Senparc.Weixin.MP SDK WeChat ?? ??? ?? ????(3): WeChat ?? ??? ?? ?? ?? ??? PHP ??? ????? ?????!

? AI ??

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

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

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

Clothoff.io
AI ? ???

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

?? ??

??? ??

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

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

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

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

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