Commit c7eec9f6 by yeran

change the get post data way from php://input to $this->request->getPost()

1 parent ecf085a9
Showing with 5 additions and 4 deletions
......@@ -57,8 +57,9 @@ abstract class Controller extends PhalconController
}
}
if (empty($input)) {
$input_string = file_get_contents('php://input');
$input_data = json_decode($input_string, true);
// $input_string = file_get_contents('php://input');
// $input_data = json_decode($input_string, true);
$input_data = $this->request->getPost();
if (is_array($input_data)) {
$input = $input_data;
} else {
......@@ -142,7 +143,7 @@ abstract class Controller extends PhalconController
}
} else {
$params = $this->request->getHeader($name);
if($params){
if ($params) {
return $params;
}
if (false !== $is_validate) {
......@@ -186,9 +187,9 @@ abstract class Controller extends PhalconController
* Q: Why make the `php://input` encapsulation?
* A: I want to use it in service mode, which is impossible to pass data via `php://input` between processes.
* This is not exactly the same as the Phalcon's implementation.
* @see \Phalcon\Http\Request::getRawBody()
* @return string
* @codeCoverageIgnore
* @see \Phalcon\Http\Request::getRawBody()
*/
protected function getRawPhpInput()
{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!