From 685d7ef3b7e9ec20759ae86b762126378ea66d86 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 May 2016 12:01:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=A7=86=E5=9B=BE=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/view/driver/Php.php | 3 ++- library/think/view/driver/Think.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index b22d4612..9b74d1df 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -56,7 +56,8 @@ class Php public function fetch($template, $data = []) { // 模板不存在 抛出异常 - if (!$this->exists($template)) { + $template = $this->exists($template); + if (!$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 9ee07b26..1b35ed41 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); + return is_file($template) ? $template : false; } /** @@ -66,7 +66,8 @@ class Think public function fetch($template, $data = [], $config = []) { // 模板不存在 抛出异常 - if (!$this->exists($template)) { + $template = $this->exists($template); + if (!$template) { throw new Exception('template file not exists:' . $template, 10700); } // 记录视图信息