求教:Restful下用命令行curl post json数据$_POST为空值?

浏览:3798 发布日期:2015/04/07 分类:求助交流
class ApiController extends RestController {
    public function test_post_json(){
        echo "test_post_json";
        dump($_POST);
    }
}
在命令行下输入curl -H "Accept:application/json" http://www.xxx.com/index.php/Api/test -X POST -d '{"aaa":"bbb"}'返回test_post_json<pre>array(0) {
}
</pre>
为什么?怎么解决?

如果输入curl -H "Accept:application/json" http://www.xxx.com/index.php/Api/test -X POST -d 'json={"aaa":"bbb"}'是可以的,但是这太傻了
最佳答案
评论( 相关
后面还有条评论,点击查看>>