關於小程序後臺post不到數據的問題

小程序post請求獲取不到數據問題

 

把headers的參數「Content-Type」的值改成application/x-www-form-urlencoded;

Request Body Type 的值應爲URLEncoded from data ;這項不改也post不到值;小程序

在js中這樣寫app

 wx.request({
      url: host + "/card/create",
      header: { "Content-Type": "application/x-www-form-urlencoded" },
      method:"POST",

      data:{
        'card_no':e.detail.value['card_no']
      },
      success:function(result){
        wx.showToast({
          title: '請求成功!',
          icon: 'success',
          mask: true,
          duration: 2000
        })
      }
相關文章
相關標籤/搜索