Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request::getArgs() can't get data from STDIN #19

Open
airylinus opened this issue Mar 21, 2014 · 1 comment
Open

Request::getArgs() can't get data from STDIN #19

airylinus opened this issue Mar 21, 2014 · 1 comment

Comments

@airylinus
Copy link

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
@tinpont
Copy link

tinpont commented Mar 27, 2014

额,看源码的我是。

    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。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants