修正Hook类 改进Template对于布局的处理

This commit is contained in:
thinkphp
2016-05-20 16:59:26 +08:00
parent d9416c7e2d
commit a24a2155eb
3 changed files with 5 additions and 3 deletions

View File

@@ -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);

View File

@@ -329,6 +329,8 @@ class Template
$content = str_replace($this->config['layout_item'], $content, file_get_contents($layoutFile));
}
}
} else {
$content = str_replace('{__NOLAYOUT__}', '', $content);
}
// 模板解析

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{__NOLAYOUT__}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />