关于Zend_Controller_Request_Abstract的一些不清楚的事情

Ric*_*nop 2 php zend-framework

我发现Zend_Controller_Request_Abstract类对我的应用程序来说相当不足,但也许我只是不知道Zend Framework中的一些方法或帮助程序.我无法对请求对象做任何事情.首先,我在控制器动作中得到它:

$request = $this->getRequest();
Run Code Online (Sandbox Code Playgroud)

现在我想得到一个GET或POST参数,但这是不可能的.我唯一能做的就是:

$foo = $request->getParam('foo');
Run Code Online (Sandbox Code Playgroud)

但我想专门从POST或GET获取参数(不必使用$ _GET和$ _POST数组).Zend_Controller_Request_Abstract搜索POST和GET,这不是很有用,因为通常你准确地知道从哪里获取参数.

如何获取原始POST数据?

如何获取原始PUT数据?

Dan*_*nna 6

您应该可以链接getRequest(),如下所示:

$postUsername = $this->getRequest()->getPost('username');

// Get All Post data
$postData = $this->getRequest()->getPost();
Run Code Online (Sandbox Code Playgroud)

看看Zend_Controller_Request_Http,它扩展了抽象类.就PUT数据而言,我看到一种方法来判断请求是否是围绕http控制器的第865行的PUT.