Skip to content
Permalink
Browse files

改进Request类

  • Loading branch information
liu21st committed Jan 15, 2019
1 parent 2db17be commit 7c24500e463704583e0778b7ec6efce607ddef5f
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/think/Request.php
@@ -836,10 +836,14 @@ public function method(bool $origin = false): string
return $this->server('REQUEST_METHOD') ?: 'GET';
} elseif (!$this->method) {
if (isset($_POST[$this->config['var_method']])) {
$this->method = strtoupper($_POST[$this->config['var_method']]);
$method = strtolower($this->method);
$method = strtolower($_POST[$this->config['var_method']]);
if (in_array($method, ['get', 'post', 'put', 'patch', 'delete'])) {
$this->method = strtoupper($method);
$this->{$method} = $_POST;
} else {
$this->method = 'POST';
}
unset($_POST[$this->config['var_method']]);
$this->{$method} = $_POST;
} elseif ($this->server('HTTP_X_HTTP_METHOD_OVERRIDE')) {
$this->method = strtoupper($this->server('HTTP_X_HTTP_METHOD_OVERRIDE'));
} else {

0 comments on commit 7c24500

Please sign in to comment.
You can’t perform that action at this time.