diff --git a/library/think/Template.php b/library/think/Template.php index 618fddb0..3124e755 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -229,9 +229,10 @@ class Template * 设置布局 * @access public * @param mixed $name 布局模板名称 false 则关闭布局 + * @param string $replace 布局模板内容替换标识 * @return object */ - public function layout($name) + public function layout($name, $replace = '') { if (false === $name) { // 关闭布局 @@ -243,6 +244,9 @@ class Template if (is_string($name)) { $this->config['layout_name'] = $name; } + if (!empty($replace)) { + $this->config['layout_item'] = $replace; + } } return $this; } diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index f06406c8..802eba61 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -26,6 +26,8 @@ class Think 'view_suffix' => '.html', // 模板文件名分隔符 'view_depr' => DS, + // 是否开启模板编译缓存,设为false则每次都会重新编译 + 'tpl_cache' => true, ]; public function __construct($config = [])