From 0521aebd1eae61c833bd48f07d7ea49b9ba13f6f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 20 Feb 2016 11:11:53 +0800 Subject: [PATCH] =?UTF-8?q?traits\controller\View=E7=B1=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0engine=E6=96=B9=E6=B3=95=E7=94=A8=E4=BA=8E=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=A8=A1=E6=9D=BF=E5=BC=95=E6=93=8E=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0validate=E5=92=8Cauto=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 2 +- library/traits/controller/View.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/convention.php b/convention.php index 020f24be..b4a045f0 100644 --- a/convention.php +++ b/convention.php @@ -10,7 +10,7 @@ return [ // 注册的根命名空间 'root_namespace' => [], // 扩展配置文件 - 'extra_config_list' => ['database', 'route'], + 'extra_config_list' => ['database', 'route', 'validate', 'auto'], // 扩展函数文件 'extra_file_list' => [THINK_PATH . 'helper' . EXT], // 默认输出类型 diff --git a/library/traits/controller/View.php b/library/traits/controller/View.php index 87aac740..6824fe98 100644 --- a/library/traits/controller/View.php +++ b/library/traits/controller/View.php @@ -72,4 +72,17 @@ trait View $this->initView(); $this->view->assign($name, $value); } + + /** + * 初始化模板引擎 + * @access protected + * @param string $engine 引擎名称 + * @param array $config 引擎参数 + * @return void + */ + public function engine($engine, $config = []) + { + $this->initView(); + $this->view->engine($engine, $config); + } }