如果要在控制器中检索作为请求主体中的标准JSON发送的数据,则可以执行以下操作:
public function yourAction(){ $params = array(); $content = $this->get("request")->getContent(); if (!empty($content)) { $params = json_depre($content, true); // 2nd param to get as array }}现在
$params将是一个充满您的JSON数据的数组。删除调用中的
true参数值
json_depre()以获取
stdClass对象。



