From 901631b8d5691ac32f01f98e5d4aa4cbd0af2b83 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 24 May 2016 17:55:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Route=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 3 ++- tests/thinkphp/baseTest.php | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 09c09ac5..60521ac3 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -401,7 +401,8 @@ class Route if (strpos($val[1], ':id') && isset($option['var'][$rule])) { $val[1] = str_replace(':id', ':' . $option['var'][$rule], $val[1]); } - self::rule($rule . $val[1] . '$', $route . '/' . $val[2], $val[0], $option, $pattern); + $rule = $rule . $val[1]; + self::rule($rule ? $rule . '$' : '', $route . '/' . $val[2], $val[0], $option, $pattern); } } } diff --git a/tests/thinkphp/baseTest.php b/tests/thinkphp/baseTest.php index 408974bc..a56c7ccd 100644 --- a/tests/thinkphp/baseTest.php +++ b/tests/thinkphp/baseTest.php @@ -46,12 +46,5 @@ class baseTest extends \PHPUnit_Framework_TestCase $this->assertTrue(!is_null(IS_CGI)); $this->assertTrue(!is_null(IS_WIN)); $this->assertTrue(!is_null(IS_CLI)); - $this->assertTrue(is_bool(IS_AJAX)); - $this->assertNotEmpty(NOW_TIME); - $this->assertNotEmpty(REQUEST_METHOD); - $this->assertTrue(is_bool(IS_GET)); - $this->assertTrue(is_bool(IS_POST)); - $this->assertTrue(is_bool(IS_PUT)); - $this->assertTrue(is_bool(IS_DELETE)); } }