使用angular4将数据发送到fuelphp

时间:2017-07-09 20:38:50

标签: angular http fuelphp

我将数据发送到fullphp,就像这样

let body = JSON.stringify({ product : 120 });
let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
let options = new RequestOptions({ headers: headers });

this.http.post(url, body, options).subscribe(

在使用Input :: all()的fuelphp中,我得到了这个

{ '{"product":9350,"versioncode":610}': '' }

如果我使用内容类型应用程序:json,我在fuelphp方面没有任何内容

我必须如何确定在燃料角可以获得它的角度方面发送数据。

1 个答案:

答案 0 :(得分:0)

改为使用Input::json()

  

json方法从json请求体返回一个json_decoded(和clean)值。

https://fuelphp.com/docs/classes/input.html#/method_json