答案 0 :(得分:0)
您需要在php后端启用cors,请参阅https://enable-cors.org/server_php.html
答案 1 :(得分:0)
大家好我得到了答案我刚在帖子中添加了以下参数。这是代码:
create(item){
let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
let options = new RequestOptions({ headers: headers });
return this.http.post("your_url_here.com/index.php",item,options)
.map(data => data.json())
.toPromise();
}