From 7efe88f0c97daf13d0faefc43bc9aefcc611b907 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 22 Jul 2016 12:51:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/think/Route.php b/library/think/Route.php index 7d5faa76..92147c8f 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1114,11 +1114,13 @@ class Route // 可选参数 $val = substr($val, 1, -1); $optional = true; + } else { + $optional = false; } if (0 === strpos($val, ':')) { // URL变量 $name = substr($val, 1); - if (!isset($optional) && !isset($m1[$key])) { + if (!$optional && !isset($m1[$key])) { return false; } if (isset($m1[$key]) && isset($pattern[$name]) && !preg_match('/^' . $pattern[$name] . '$/', $m1[$key])) {