修正rest控制器

This commit is contained in:
thinkphp
2017-09-28 14:11:00 +08:00
parent 616f7b73ba
commit 10182a8bb5

View File

@@ -43,7 +43,7 @@ abstract class Rest
if ('' == $ext) { if ('' == $ext) {
// 自动检测资源类型 // 自动检测资源类型
$this->type = $request->type(); $this->type = $request->type();
} elseif (!preg_match('/\(' . $this->restTypeList . '\)$/i', $ext)) { } elseif (!preg_match('/(' . $this->restTypeList . ')$/i', $ext)) {
// 资源类型非法 则用默认资源类型访问 // 资源类型非法 则用默认资源类型访问
$this->type = $this->restDefaultType; $this->type = $this->restDefaultType;
} else { } else {
@@ -51,7 +51,7 @@ abstract class Rest
} }
// 请求方式检测 // 请求方式检测
$method = strtolower($request->method()); $method = strtolower($request->method());
if (false === stripos($this->restMethodList, $method)) { if (!preg_match('/(' . $this->restMethodList . ')$/i', $method)) {
// 请求方式非法 则用默认请求方法 // 请求方式非法 则用默认请求方法
$method = $this->restDefaultMethod; $method = $this->restDefaultMethod;
} }