From fd53cfa9f2dcd6f00a24545d2cad5549de3dc151 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 12 Jan 2016 22:43:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4View=E7=B1=BB=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=B0=83=E8=AF=95=E6=A8=A1=E5=BC=8F=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=A5=E6=A0=BC=E6=A3=80=E6=9F=A5=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/View.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/library/think/View.php b/library/think/View.php index 70653835..eb6ff3cb 100644 --- a/library/think/View.php +++ b/library/think/View.php @@ -30,7 +30,7 @@ class View 'http_cache_id' => null, 'view_path' => '', 'view_suffix' => '.html', - 'view_depr' => '/', + 'view_depr' => DS, 'view_layer' => VIEW_LAYER, 'parse_str' => [], 'engine_type' => 'think', @@ -153,8 +153,9 @@ class View if (!$renderContent) { // 获取模板文件名 $template = $this->parseTemplate($template); + // 开启调试模式Win环境严格区分大小写 // 模板不存在 抛出异常 - if (!is_file($template)) { + if (!is_file($template) || (APP_DEBUG && IS_WIN && realpath($template) != $template)) { throw new Exception('template file not exists:' . $template, 10700); } } @@ -209,7 +210,7 @@ class View return $template; } $depr = $this->config['view_depr']; - $template = str_replace(':', $depr, $template); + $template = str_replace(['/', ':'], $depr, $template); // 获取当前模块 $module = MODULE_NAME; @@ -257,7 +258,7 @@ class View } else { $theme = $this->config['default_theme']; } - return $theme . '/'; + return $theme . DS; } return ''; } @@ -278,7 +279,7 @@ class View // 定义TMPL_PATH 则改变全局的视图目录到模块之外 $tmplPath = defined('TMPL_PATH') ? TMPL_PATH . $module . DS : APP_PATH . (APP_MULTI_MODULE ? $module . DS : '') . $this->config['view_layer'] . DS; } - return $tmplPath . $theme; + return realpath($tmplPath) . DS . $theme; } /**