mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
修正Hook类 改进Template对于布局的处理
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -329,6 +329,8 @@ class Template
|
||||
$content = str_replace($this->config['layout_item'], $content, file_get_contents($layoutFile));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$content = str_replace('{__NOLAYOUT__}', '', $content);
|
||||
}
|
||||
|
||||
// 模板解析
|
||||
|
||||
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user