thinkphp5模板布局的配置方法
thinkphp5 模板布局配置与展示
thinkphp5模板布局配置与展示代码分析

1、在config.php中开启配置
在该模块下建立config.php 文件然后进行config.php 文件的配置,配置代码如下,开通thinkphp5模板配置。
<?php
//配置文件
return [
"template"=>[
"layout_on" =>true,
"layout_name" =>"layout",
]
];
2、在view下建立 layout.html 模板
{include file="public/header" /}
<div style="width:100%;height: 30px; background:#f00;">header展示</div>
{__CONTENT__}
<div style="width:100%;height: 30px; background:#f0f;">footer展示</div>></div>
{include file="public/footer"}
3、视图展示,视图自动继承layout模板进行展示
在view 的public目录下建立header.html 文件 ,文件放置header
在view 的public目录下建立footer.html 文件 ,文件放置footer
4、加载展示如下

layout.html是默认的模板,如果使用默认模块,config.php的配置文件也可以不用配置,但如果非默认的模板如newlayout.html ,那么就一定需要进行盘子里。
但通常建议还是进行配置为好。
但通常建议还是进行配置为好。
点击展开全部↓↓↓↓
thinkphp5模板布局的配置方法网址: http://www.fsdpjq.com/wzkf/620.html