From 6599c8c758ded4e1ad0e6ca8a97ed265340cc8c8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 30 May 2016 22:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Request=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/think/Request.php b/library/think/Request.php index df023124..f483e6c3 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -413,7 +413,10 @@ class Request */ public function method($method = '') { - if ($method) { + if (true === $method) { + // 获取原始请求类型 + return IS_CLI ? 'GET' : (isset($this->server['REQUEST_METHOD']) ? $this->server['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']); + } elseif ($method) { $this->method = $method; return; } elseif (!$this->method) { @@ -497,7 +500,7 @@ class Request public function param($name = '', $default = null) { if (empty($this->param)) { - $method = $this->method(); + $method = $this->method(true); // 自动获取请求变量 switch ($method) { case 'POST':