From a24a2155eb9f66fe7e585bba275170d2b7e67c7c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 May 2016 16:59:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Hook=E7=B1=BB=20=E6=94=B9?= =?UTF-8?q?=E8=BF=9BTemplate=E5=AF=B9=E4=BA=8E=E5=B8=83=E5=B1=80=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Hook.php | 4 ++-- library/think/Template.php | 2 ++ tpl/dispatch_jump.tpl | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/think/Hook.php b/library/think/Hook.php index 7f5de18c..0ac83e85 100644 --- a/library/think/Hook.php +++ b/library/think/Hook.php @@ -122,9 +122,9 @@ class Hook public static function exec($class, $tag = '', &$params = null) { if ($class instanceof \Closure) { - $result = call_user_func_array($class, [$params]); + $result = call_user_func_array($class, [ & $params]); } elseif (is_object($class)) { - $result = call_user_func_array([$class, $tag], [$params]); + $result = call_user_func_array([$class, $tag], [ & $params]); } else { $obj = new $class(); $result = ($tag && is_callable([$obj, $tag])) ? $obj->$tag($params) : $obj->run($params); diff --git a/library/think/Template.php b/library/think/Template.php index eb721036..844448f4 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -329,6 +329,8 @@ class Template $content = str_replace($this->config['layout_item'], $content, file_get_contents($layoutFile)); } } + } else { + $content = str_replace('{__NOLAYOUT__}', '', $content); } // 模板解析 diff --git a/tpl/dispatch_jump.tpl b/tpl/dispatch_jump.tpl index 9b568fa1..18ee01bd 100644 --- a/tpl/dispatch_jump.tpl +++ b/tpl/dispatch_jump.tpl @@ -1,4 +1,4 @@ - +{__NOLAYOUT__}