我试图张贴到汽车记录的例子
I am trying to post to a car record example
Restangular.one('cars', 5).post('bids', {data: 'Some data'}).then(function() {
$state.go('^');
});
或
Restangular.one('cars', 5).all('bids').post({data: 'Some data'}).then(function() {
$state.go('^');
});
由于某些原因, {数据:一些数据'}
正在发送一个JSON有效载荷,而不是POST形式参数。我在做什么错了?
For some reason the {data: 'Some data'}
is being sent as a JSON payload instead of POST form parameters. What am I doing wrong?
那么,如果你使用的是PHP那么你可以得到完整JSON有效载荷是这样的:
Well if you are using PHP then you can get full json payload like this:
$data = (array) json_decode(file_get_contents('php://input'));
这$数据将包含所有你通过HTTP POST发送POST数据。
this $data will contain all the post data you sent through http post.