From 9a6b90cc697fe95bc37517488eb73b5736f1617e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Jul 2016 17:28:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRoute=E7=B1=BB=E7=9A=84check?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20=E5=AF=B9=E5=88=86=E7=BB=84=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E7=9A=84=E5=AE=8C=E5=96=84=20=E6=94=B9=E8=BF=9BPHP?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=BC=95=E6=93=8E=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 2 +- library/think/view/driver/Php.php | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 18f055a6..ad3b603b 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -745,7 +745,7 @@ class Route continue; } if ($group) { - $rule = $group . '/' . ltrim($rule, '/'); + $rule = $group . ($rule ? '/' . ltrim($rule, '/') : ''); } $result = self::checkRule($rule, $route, $url, $pattern, $option); if (false !== $result) { diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index 13820baa..a7e72e9e 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -67,8 +67,14 @@ class Php } // 记录视图信息 App::$debug && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]', 'info'); - extract($data, EXTR_OVERWRITE); - include $template; + if (isset($data['template'])) { + $__template__ = $template; + extract($data, EXTR_OVERWRITE); + include $__template__; + } else { + extract($data, EXTR_OVERWRITE); + include $template; + } } /** @@ -80,8 +86,14 @@ class Php */ public function display($content, $data = []) { - extract($data, EXTR_OVERWRITE); - eval('?>' . $content); + if (isset($data['content'])) { + $__content__ = $content; + extract($data, EXTR_OVERWRITE); + eval('?>' . $__content__); + } else { + extract($data, EXTR_OVERWRITE); + eval('?>' . $content); + } } /**