5.1.x系列,编辑 library/think/Request.php 文件, 查找如下内容:
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
$this->{$method} = $_POST;
修改为:
$method = strtoupper($_POST[Config::get('var_method')]);
if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
$method = strtolower($this->method);
$this->{$method} = $_POST;
}
5.2.x系列,编辑 src/think/Request.php文件, 查找:
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
unset($_POST[$this->config['var_method']]);
$this->{$method} = $_POST;
修改为:
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
unset($_POST[$this->config['var_method']]);
$this->{$method} = $_POST;
}
2019-01-15