Get post data, Zend Framework

倾然丶 夕夏残阳落幕 提交于 2019-12-21 07:00:11

问题


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' );

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


回答1:


Here is my solution;)

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



回答2:


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




回答3:


Here is an other example:

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



回答4:


Try this:

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


来源:https://stackoverflow.com/questions/3745865/get-post-data-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!