【发布时间】:2018-08-18 23:10:36
【问题描述】:
我正在以角度发送帖子请求
public saveLead(name: string, phone: string, text: string){
const params: Lead = new Lead(name,phone,text);
const headers = {
'Content-Type':'application/x-www-form-urlencoded'
};
return this.http.post('http://127.0.0.1/saveLead', params, {headers});
}
但是当我在 php 端检查 $_POST 时它总是空的
【问题讨论】:
-
你能登录
params吗?里面有什么? -
是的,在参数中我有 Lead object Lead {name: "ff", phone: "ff", text: "dd"}
-
尝试将
Content-Type更改为 json 为:'Content-Type':'application/json'