【发布时间】:2013-03-13 11:01:48
【问题描述】:
我在使用 Restler API Explorer 将 JSON 数据发布到我的 Restler Web 服务时遇到问题。
这是一个例子
/**
* Inserts a product
*
* @param string $product_id {@from body} The SKU for the product
* @return a product object which contains the product
*/
function post($product_id=NULL, $request_data=NULL){
error_log(var_export($request_data,1));
}
当我通过资源管理器发布以下 JSON 字符串时
{"product_id": "MOO"}
我在日志中得到以下输出
array ('{____"product_id":_"MOO"}' => '','index_url' => 'index',)
如果我使用 CURL,例如
curl -X POST http://xxx.xxx.xxx/products.json -H "Content-Type: application/json" -d '{"product_id": "MOO"}'
我明白了
array ('product_id' => 'MOO','index_url' => 'index',)
这是我所期望的。
能看出哪里不对吗?
干杯 抢
【问题讨论】: