所以才说垃圾嘛! 简简单单的事情,非要搞得模棱两可,做事情就不能做好吗?
申请开放平台的app上传什么水印图?申请开放平台的app上传什么水印图?带应用名称的图片不行,要加什么水印?给的示例就一个微信图片,有啥水印?
2020-11-10https://developers.weixin.qq.com/blogdetail?action=get_post_info&lang=zh_CN&token=1640335374&docid=0002a4ddf48f00cf00f6bab995d800
wx:request的post数据里带数组时的问题[代码]wx.request({[代码][代码] [代码][代码]url: xxx, [代码][代码]//仅为示例,并非真实的接口地址[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]"rs"[代码][代码]: [代码][代码]"login"[代码][代码],[代码][代码] [代码][代码]"rsargs"[代码][代码]: [ [代码][代码]'aaa'[代码][代码],1 ][代码][代码] [代码][代码]},[代码][代码] [代码][代码]method: [代码][代码]"POST"[代码][代码],[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码][代码]: [代码][代码]'application/x-www-form-urlencoded'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码] [代码] [代码][代码]}[代码][代码]})[代码]请求的格式是下面这样的 [图片] *******但需要是下面这样子的格式。后台php才好获取,请问需要怎么设置才行 [图片]
2018-07-04估计你和我遇到的问题是一样的。 解决方法,使用jquery的param方法 包装参数就好了 1. header配置为 x-www-formxxxxx.... [图片] 2. 包装参数 [图片] reqData = this._param(reqData);其中 _param 就是 jquery的$.param方法 copy过来就好。 [代码]_param: [代码][代码]function[代码] [代码](a, traditional) {[代码][代码] [代码][代码]var[代码] [代码]class2type = {};[代码][代码] [代码][代码]var[代码] [代码]toString = class2type.toString;[代码][代码] [代码][代码]var[代码] [代码]hasOwn = class2type.hasOwnProperty;[代码] [代码] [代码][代码]function[代码] [代码]toType(obj) {[代码][代码] [代码][代码]if[代码] [代码](obj == [代码][代码]null[代码][代码]) {[代码][代码] [代码][代码]return[代码] [代码]obj + [代码][代码]""[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]// Support: Android <=2.3 only (functionish RegExp)[代码][代码] [代码][代码]return[代码] [代码]typeof[代码] [代码]obj === [代码][代码]"object"[代码] [代码]|| [代码][代码]typeof[代码] [代码]obj === [代码][代码]"function"[代码] [代码]?[代码][代码] [代码][代码]class2type[toString.call(obj)] || [代码][代码]"object"[代码] [代码]:[代码][代码] [代码][代码]typeof[代码] [代码]obj;[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]var[代码] [代码]isFunction = [代码][代码]function[代码] [代码]isFunction(obj) {[代码][代码] [代码][代码]// Support: Chrome <=57, Firefox <=52[代码][代码] [代码][代码]// In some browsers, typeof returns "function" for HTML <object> elements[代码][代码] [代码][代码]// (i.e., `typeof document.createElement( "object" ) === "function"`).[代码][代码] [代码][代码]// We don't want to classify *any* DOM node as a function.[代码][代码] [代码][代码]return[代码] [代码]typeof[代码] [代码]obj === [代码][代码]"function"[代码] [代码]&& [代码][代码]typeof[代码] [代码]obj.nodeType !== [代码][代码]"number"[代码][代码];[代码][代码] [代码][代码]};[代码] [代码] [代码][代码]var[代码][代码] [代码][代码]rbracket = /\[\]$/,[代码][代码] [代码][代码]rCRLF = /\r?\n/g,[代码][代码] [代码][代码]rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,[代码][代码] [代码][代码]rsubmittable = /^(?:input|select|textarea|keygen)/i;[代码] [代码] [代码][代码]function[代码] [代码]buildParams(prefix, obj, traditional, add) {[代码][代码] [代码][代码]var[代码] [代码]name;[代码] [代码] [代码][代码]if[代码] [代码](Array.isArray(obj)) {[代码] [代码] [代码][代码]// Serialize array item.[代码][代码] [代码][代码]obj.forEach([代码][代码]function[代码] [代码](v, i) {[代码][代码] [代码][代码]if[代码] [代码](traditional || rbracket.test(prefix)) {[代码] [代码] [代码][代码]// Treat each array item as a scalar.[代码][代码] [代码][代码]add(prefix, v);[代码] [代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码] [代码] [代码][代码]// Item is non-scalar (array or object), encode its numeric index.[代码][代码] [代码][代码]buildParams([代码][代码] [代码][代码]prefix + [代码][代码]"["[代码] [代码]+ ( [代码][代码]typeof[代码] [代码]v === [代码][代码]"object"[代码] [代码]&& v != [代码][代码]null[代码] [代码]? i : [代码][代码]""[代码] [代码]) + [代码][代码]"]"[代码][代码],[代码][代码] [代码][代码]v,[代码][代码] [代码][代码]traditional,[代码][代码] [代码][代码]add[代码][代码] [代码][代码]);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]} [代码][代码]else[代码] [代码]if[代码] [代码](!traditional && toType(obj) === [代码][代码]"object"[代码][代码]) {[代码] [代码] [代码][代码]// Serialize object item.[代码][代码] [代码][代码]for[代码] [代码](name [代码][代码]in[代码] [代码]obj) {[代码][代码] [代码][代码]buildParams(prefix + [代码][代码]"["[代码] [代码]+ name + [代码][代码]"]"[代码][代码], obj[name], traditional, add);[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码] [代码] [代码][代码]// Serialize scalar item.[代码][代码] [代码][代码]add(prefix, obj);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]// Serialize an array of form elements or a set of[代码][代码] [代码][代码]// key/values into a query string[代码][代码] [代码][代码]var[代码] [代码]param = [代码][代码]function[代码] [代码](a, traditional) {[代码][代码] [代码][代码]var[代码] [代码]prefix,[代码][代码] [代码][代码]s = [],[代码][代码] [代码][代码]add = [代码][代码]function[代码] [代码](key, valueOrFunction) {[代码] [代码] [代码][代码]// If value is a function, invoke it and use its return value[代码][代码] [代码][代码]var[代码] [代码]value = isFunction(valueOrFunction) ?[代码][代码] [代码][代码]valueOrFunction() :[代码][代码] [代码][代码]valueOrFunction;[代码] [代码] [代码][代码]s[s.length] = encodeURIComponent(key) + [代码][代码]"="[代码] [代码]+[代码][代码] [代码][代码]encodeURIComponent(value == [代码][代码]null[代码] [代码]? [代码][代码]""[代码] [代码]: value);[代码][代码] [代码][代码]};[代码] [代码] [代码][代码]// If an array was passed in, assume that it is an array of form elements.[代码][代码] [代码][代码]if[代码] [代码](Array.isArray(a)) {[代码] [代码] [代码][代码]// Serialize the form elements[代码][代码] [代码][代码]a.forEach([代码][代码]function[代码] [代码](item) {[代码][代码] [代码][代码]add(item.name, item.value);[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码] [代码] [代码][代码]// If traditional, encode the "old" way (the way 1.3.2 or older[代码][代码] [代码][代码]// did it), otherwise encode params recursively.[代码][代码] [代码][代码]for[代码] [代码](prefix [代码][代码]in[代码] [代码]a) {[代码][代码] [代码][代码]buildParams(prefix, a[prefix], traditional, add);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]// Return the resulting serialization[代码][代码] [代码][代码]return[代码] [代码]s.join([代码][代码]"&"[代码][代码]);[代码][代码] [代码][代码]};[代码][代码] [代码][代码]return[代码] [代码]param(a, traditional);[代码][代码] [代码][代码]},[代码]偷个懒 直接copy粘贴过来 试试吧,我这边测试没有问题 [图片]
wx.request 普通表单无法提交数组'content-type': 'application/x-www-form-urlencoded; charset=UTF-8' 当使用表单方式提交的时候,无法像浏览器一样传输数组。希望尽快修复。 [代码]wx.request({[代码][代码] [代码][代码]url: xxx, [代码][代码]//仅为示例,并非真实的接口地址[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]"rs"[代码][代码]: [代码][代码]"login"[代码][代码],[代码][代码] [代码][代码]"rsargs"[代码][代码]: [ [代码][代码]'aaa'[代码][代码],[代码][代码]1[代码] [代码]][代码][代码] [代码][代码]},[代码][代码] [代码][代码]method: [代码][代码]"POST"[代码][代码],[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码][代码]: [代码][代码]'application/x-www-form-urlencoded'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码] [代码] [代码][代码]}[代码][代码]})[代码]请求的格式是下面这样的 [图片] 正常浏览器是这样的 [图片]
2018-07-02