Request::getArgs() can't get data from STDIN
airylinus opened this issue · comments
Request::getArgs() can't get data from STDIN when client post JSON / XML to Server.
for example:
post JSON via angularjs
$http({
url: '/api/task/create',
method: "POST",
data: JSON.stringify(newTask)
}).success(function(data) {
console.log(data);
})
})
in Action:
$this->request->getArgs(); // got nothing
额,看源码的我是。
public function getArg($name)
{
if (isset($_POST[$name])) {
return $_POST[$name];
} else if (isset($_GET[$name])) {
return $_GET[$name];
} else if (isset($this->_jsonParams[$name])) {
return $this->_jsonParams[$name];
}
return false;
}
看情况必须一个个单独取出来,你的getArgs()漏了参数name。