有三种布局模板的支持方式:
官网手册:https://www.kancloud.cn/manual/thinkphp5_1/354079
第一种方式:全局配置方式
比较适用于全站使用相同布局的情况,需要配置开启layout_on
参数(默认不开启),并且设置布局入口文件名layout_name
(默认为layout)。
如不开启layout_on,会默认渲染application/index/view/index/index.html模板文件,但是开启layout_on后,会先渲染
application/index/view/layout.html模板,再用application/index/view/index/index.html的内容代替
application/index/view/layout.html模板中的{__CONTENT__}
结果如下:
如有错误,欢迎指正。如果喜欢或者对你有帮助,就给个赞吧,嘿嘿嘿!