Skip to content

Commit

Permalink
改进swoole的method方法获取
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jul 2, 2018
1 parent 0af55a5 commit 833fcaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/think/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ public function method($origin = false)
{
if ($origin) {
// 获取原始请求类型
return $this->isCli() ? 'GET' : $this->server('REQUEST_METHOD');
return $this->server('REQUEST_METHOD') ?: 'GET';
} elseif (!$this->method) {
if (isset($_POST[$this->config['var_method']])) {
$this->method = strtoupper($_POST[$this->config['var_method']]);
Expand All @@ -792,7 +792,7 @@ public function method($origin = false)
} elseif ($this->server('HTTP_X_HTTP_METHOD_OVERRIDE')) {
$this->method = strtoupper($this->server('HTTP_X_HTTP_METHOD_OVERRIDE'));
} else {
$this->method = $this->isCli() ? 'GET' : $this->server('REQUEST_METHOD');
$this->method = $this->server('REQUEST_METHOD') ?: 'GET';
}
}

Expand Down

0 comments on commit 833fcaf

Please # to comment.