From c3015bf1c45bfaadb621851dd9a4bf3f42341cf3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 22 Aug 2016 12:39:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=B7=AF=E7=94=B1=E7=9A=84?= =?UTF-8?q?=20=E5=90=8E=E7=BC=80=E5=8F=82=E6=95=B0=E8=AF=86=E5=88=AB=20?= =?UTF-8?q?=E4=BC=98=E5=85=88=E4=BA=8E=E7=B3=BB=E7=BB=9F=E7=9A=84=E4=BC=AA?= =?UTF-8?q?=E9=9D=99=E6=80=81=E5=90=8E=E7=BC=80=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 819c325e..4e83a340 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -864,6 +864,11 @@ class Route continue; } + if (isset($option['ext'])) { + // 路由ext参数 优先于系统配置的URL伪静态后缀参数 + $url = preg_replace('/\.' . $request->ext() . '$/i', '', $url); + } + if (is_array($rule)) { // 分组路由 if (($pos = strpos($key, ':')) || ($pos = strpos($key, '<'))) { @@ -1310,7 +1315,7 @@ class Route // 解析额外参数 self::parseUrlParams(empty($paths) ? '' : implode('/', $paths), $matches); // 记录匹配的路由信息 - Request::instance()->routeInfo(['rule' => $rule, 'route' => $route, 'option' => $option]); + Request::instance()->routeInfo(['rule' => $rule, 'route' => $route, 'option' => $option, 'var' => $matches]); // 检测路由after行为 if (!empty($option['after_behavior'])) { @@ -1382,7 +1387,7 @@ class Route * @param array $var 变量 * @return void */ - private static function parseUrlParams($url, $var = []) + private static function parseUrlParams($url, &$var = []) { if ($url) { if (Config::get('url_param_type')) {