别名路由增加操作白名单

This commit is contained in:
thinkphp
2016-10-12 22:26:38 +08:00
parent 245dba00a7
commit 112f225065

View File

@@ -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)) {