开发者

Get post data, Zend Framework

开发者 https://www.devze.com 2023-01-16 22:53 出处:网络
I want to fetch posted data. But I am using no form. The data is postet by a jquery script with method post and I would like to fetch it.

I want to fetch posted data. But I am using no form. The data is postet by a jquery script with method post and I would like to fetch it.

I know how to fetch parameters

$id = $this->getRequest ()->getParam ( 'id', null );

and form values

$message = $form->getValue ( 'message' );
开发者_Go百科

however I want to access post data and not parameters or form values. Any ideas?


Here is my solution;)

$this->getRequest()->getPost('id', null);


Actually, this might be more of what you're looking for.

$this->getRequest()->getRawBody();

https://framework.zend.com/manual/1.12/en/zend.controller.request.html


Here is an other example:

$this->getRequest()->getPost()->toArray()


Try this:

$request = $this->getRequest();
$request->getPost('field_name');
0

精彩评论

暂无评论...
验证码 换一张
取 消