diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index 31fe7807..4f3d7e85 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -119,9 +119,11 @@ class Php // 分析模板文件规则 $request = Request::instance(); $controller = Loader::parseName($request->controller()); - if ($controller && 0 !== strpos($template, '/')) { - $depr = $this->config['view_depr']; + $depr = $this->config['view_depr']; + if (0 !== strpos($template, '/')) { $template = str_replace(['/', ':'], $depr, $template); + } + if ($controller) { if ('' == $template) { // 如果模板文件名为空 按照默认规则定位 $template = str_replace('.', DS, $controller) . $depr . $request->action(); diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index db1d9816..8e673fde 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -121,9 +121,11 @@ class Think } $controller = Loader::parseName($request->controller()); - if ($controller && 0 !== strpos($template, '/')) { - $depr = $this->config['view_depr']; + $depr = $this->config['view_depr']; + if (0 !== strpos($template, '/')) { $template = str_replace(['/', ':'], $depr, $template); + } + if ($controller) { if ('' == $template) { // 如果模板文件名为空 按照默认规则定位 $template = str_replace('.', DS, $controller) . $depr . $request->action();