Php 当HTTP方法是Phalcon 1.3.x中的补丁时,如何获取表单数据?

Php 当HTTP方法是Phalcon 1.3.x中的补丁时,如何获取表单数据?,php,http,phalcon,Php,Http,Phalcon,我测试了在phalcon 1.3.x中HTTP方法是补丁时获取表单数据。阅读手册和源代码后,可以确保指定版本的phalcon没有在phalcon\Http\Request中提供getPatch() 我尝试了$this->request->getPut()或$this->request->getPost(),但不起作用。它总是返回空数组 当HTTP方法是phalcon 1.3.x中的补丁时,如何获取表单数据?google没有找到任何解决方案,因此我扩展了phalcon请求并实现了getPatch(

我测试了在phalcon 1.3.x中HTTP方法是补丁时获取表单数据。阅读手册和源代码后,可以确保指定版本的phalcon没有在
phalcon\Http\Request
中提供
getPatch()

我尝试了
$this->request->getPut()
$this->request->getPost()
,但不起作用。它总是返回空数组


当HTTP方法是phalcon 1.3.x中的补丁时,如何获取表单数据?

google没有找到任何解决方案,因此我扩展了phalcon请求并实现了
getPatch()
hasPatch()
方法

用法:

// get all patch data...
$params = $this->request->getPatch(); 

// try to get username from patch data
$name = $this->request->getPatch('username');   

// try to get and format price
$price = $this->request->getPatch('price', 'float!'); 
在使用它之前,先注入新的请求类

$di->set('request', function() {
    return new \Request();
}, true);
Github上的代码:

使用$this->request->getPut()它在4.0中工作,需要HTTP头

内容类型

在我的变体应用程序/json中