From dd8fb56b1002a442488541ef7c5ecde467561552 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 21 May 2016 23:11:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=A7=86=E5=9B=BE=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/view/driver/Php.php | 7 +++++-- library/think/view/driver/Think.php | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index 9ab33119..3063bc02 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -55,9 +55,12 @@ class Php */ public function fetch($template, $data = []) { + if (!is_file($template)) { + // 获取模板文件名 + $template = $this->parseTemplate($template); + } // 模板不存在 抛出异常 - $template = $this->exists($template); - if (!$template) { + if (!is_file($template)) { throw new Exception('template file not exists:' . $template, 10700); } // 记录视图信息 diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index ac7a84b0..8eb85e26 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -52,7 +52,7 @@ class Think // 获取模板文件名 $template = $this->parseTemplate($template); } - return is_file($template) ? $template : false; + return is_file($template); } /** @@ -65,9 +65,12 @@ class Think */ public function fetch($template, $data = [], $config = []) { + if (!is_file($template)) { + // 获取模板文件名 + $template = $this->parseTemplate($template); + } // 模板不存在 抛出异常 - $template = $this->exists($template); - if (!$template) { + if (!is_file($template)) { throw new Exception('template file not exists:' . $template, 10700); } // 记录视图信息