我正在使用此获取参数
- $this->params()->fromQuery('KEY');
- //first way
- $this->params()->fromPost('KEY',null);
- //second way
- $this->getRequest()->getPost();
您需要阅读请求正文并解析它,如下所示:
- $putParams = array();
- parse_str($this->getRequest()->getContent(),$putParams);
这会将所有参数解析为$putParams-array,因此您可以像访问超级全局$_POST或$_GET一样访问它.例如:
- // Get the parameter named 'id'
- $id = $putParams['id'];
- // Loop over all params
- foreach($putParams as $key => $value) {
- echo 'Put-param ' . $key . ' = ' . $value . PHP_EOL;
- }