From 3a154657e34c26aa61239418ac80bb0f7517fb4d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 1 Jun 2016 18:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20VIEW=5FPATH=20=E5=B8=B8?= =?UTF-8?q?=E9=87=8F=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 6 ++---- library/think/view/driver/Php.php | 4 ++-- library/think/view/driver/Think.php | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index 7e8f8d14..082e8737 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -243,8 +243,6 @@ class App // 模块初始化 if ($module && $available) { - define('MODULE_PATH', APP_PATH . $module . DS); - define('VIEW_PATH', MODULE_PATH . 'view' . DS); // 初始化模块 $config = self::initModule($module, $config); } else { @@ -253,9 +251,9 @@ class App } else { // 单一模块部署 $module = ''; - define('MODULE_PATH', APP_PATH); - define('VIEW_PATH', MODULE_PATH . 'view' . DS); } + // 当前模块路径 + define('MODULE_PATH', APP_PATH . ($module ? $module . DS : '')); // 获取控制器名 $controller = strip_tags($result[1] ?: $config['default_controller']); diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index ac101ea5..5eda4faf 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -91,8 +91,8 @@ class Php */ private function parseTemplate($template) { - if (empty($this->config['view_path']) && defined('VIEW_PATH')) { - $this->config['view_path'] = VIEW_PATH; + if (empty($this->config['view_path']) && defined('MODULE_PATH')) { + $this->config['view_path'] = MODULE_PATH . 'view' . DS; } if (strpos($template, '@')) { diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index ddc3e7b7..10ef587d 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -35,8 +35,8 @@ class Think public function __construct($config = []) { $this->config = array_merge($this->config, $config); - if (empty($this->config['view_path']) && defined('VIEW_PATH')) { - $this->config['view_path'] = VIEW_PATH; + if (empty($this->config['view_path']) && defined('MODULE_PATH')) { + $this->config['view_path'] = MODULE_PATH . 'view' . DS; } $this->template = new Template($this->config); }