From 112f22506510fe1f2ed569fcb3ddf23aa3449b27 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 12 Oct 2016 22:26:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=AB=E5=90=8D=E8=B7=AF=E7=94=B1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=93=8D=E4=BD=9C=E7=99=BD=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/think/Route.php b/library/think/Route.php index 98bca3d4..ca97e505 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -944,7 +944,13 @@ class Route if (is_array($item)) { list($rule, $option) = $item; $action = $array[0]; - if (isset($option['except'])) { + if (isset($option['allow'])) { + // 允许操作 + $allow = is_string($option['allow']) ? explode(',', $option['allow']) : $option['allow']; + if (!in_array($action, $allow)) { + return false; + } + } elseif (isset($option['except'])) { // 排除操作 $except = is_string($option['except']) ? explode(',', $option['except']) : $option['except']; if (in_array($action, $except)) {