设置
header
中的content-type
为application/x-www-form-urlencoded
const data = {
username: 'user',
password: 'pass'
};
uni.request({
url: 'https://your-api-endpoint.com/resource', // 你的API接口地址
method: 'PUT',
data: data,
header: {
'content-type': 'application/x-www-form-urlencoded',
},
success: (res) => {
console.log('PUT请求成功', res.data);
},
fail: (err) => {
console.error('PUT请求失败', err);
}
});