收藏
回答

【求助】小程序怎么对url进行编码

小程序怎么对url进行编码

求贴个代码,谢谢
回答关注问题邀请回答
收藏

1 个回答

  • yan
    yan
    2017-08-11

    data 数据说明 最终发送给服务器的数据是 String 类型,如果传入的 data 不是 String 类型,会被转换成 String 。转换规则如下:

    • 对于 header['content-type'] 为 'application/json' 的数据,会对数据进行 JSON 序列化

    • 对于 header['content-type'] 为 'application/x-www-form-urlencoded' 的数据,会将数据转换成 query string (encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)

    https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html#wxrequestobject

    2017-08-11
    有用
    回复
登录 后发表内容