From 10182a8bb553fe1b8cb2ae641308ef074ddd83ac Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 28 Sep 2017 14:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3rest=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/controller/Rest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/controller/Rest.php b/library/think/controller/Rest.php index 8c5911df..2a28057e 100644 --- a/library/think/controller/Rest.php +++ b/library/think/controller/Rest.php @@ -43,7 +43,7 @@ abstract class Rest if ('' == $ext) { // 自动检测资源类型 $this->type = $request->type(); - } elseif (!preg_match('/\(' . $this->restTypeList . '\)$/i', $ext)) { + } elseif (!preg_match('/(' . $this->restTypeList . ')$/i', $ext)) { // 资源类型非法 则用默认资源类型访问 $this->type = $this->restDefaultType; } else { @@ -51,7 +51,7 @@ abstract class Rest } // 请求方式检测 $method = strtolower($request->method()); - if (false === stripos($this->restMethodList, $method)) { + if (!preg_match('/(' . $this->restMethodList . ')$/i', $method)) { // 请求方式非法 则用默认请求方法 $method = $this->restDefaultMethod; }