微信小程序------MD5加密(支持中文和不支持中文)和网络请求(get和post)
开发中常常遇到MD5加密,最近做小程序也用到了,简单总结了一下; 这要有两个加密文件,一个不支持中文,一个支持,所以你选择支持的来用就行了; 也随便说说小程序的get和post网络请求。 来看看效果图: 网络请求代码: requestData: function (appid, token, itype, callback, offset, count){ wx.request({ url: "xxxxxx", method: "POST",//GET data: { m: 'api', appid: appid, token: token, c: itype, a: 'batchget', offset: offset, count: count }, header: { 'Content-Type': 'application/x-www-form-urlencoded', //POST //'content-type': 'application/json' //GET }, success: function (res) { console.log(res.data.data) callback(res.data.data) } }) }, 当然有点前提,微信小程序网络请求需要去微信平台服务器域名配置, 当然也可以有第二种方式,勾选不验证域名,