微信小程序想实现 模板消息推送的话php
1.登陆到微信公众平台 - 小程序 - 开发 - 开发设置 。 找到消息推送小程序
2.验证消息的确来自微信服务器微信小程序
微信只提供了php检验的代码段,还缺乏返回参数的方法服务器
// GET: Common /// <summary> /// 微信小程序模板校验签名 /// </summary> /// <returns></returns> [System.Web.Http.HttpGet] public void CheckSignature(string signature, string timestamp, string nonce, string echostr) { var token = ConfigurationManager.AppSettings["Token"]; string[] ArrTmp = { token, timestamp, nonce }; Array.Sort(ArrTmp); string tmpStr = string.Join("", ArrTmp); tmpStr = FormsAuthentication.HashPasswordForStoringInConfigFile(tmpStr, "SHA1"); tmpStr = tmpStr.ToLower(); if (tmpStr == signature) { HttpContext.Current.Response.Write(echostr); HttpContext.Current.Response.End(); } HttpContext.Current.Response.Write("校验失败"); HttpContext.Current.Response.End(); }
3.填写服务器配置微信
而后就能够填写服务器配置,提交验证签名了!微信公众平台