找到config.php添加如下配置

//layout布局
    'template'  =>  [
        'layout_on'     =>  true,
        'layout_name'   =>  'layout',
    ]

 

然后在view层目录下创建一个layout.html页面,里面的内容如下:

{include file="public/header" /}
{__CONTENT__}
{include  file="public/footer" /}

 

 

然后在view层里面创建一个public文件夹,文件夹里面有两个页面,header.html  和  footer.html

找到页面公共的部分放进去就可以了

 

注意:页面的头部和尾部自己选取,但是要注意样式,遇到缓存删除runtime里面的temp文件夹下面的内容就可以

tp5实现使用layout布局

 

 

参考网址:https://blog.csdn.net/u012600104/article/details/78973494

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2021-10-24
  • 2021-11-13
  • 2021-12-15
  • 2021-12-30
相关资源
相似解决方案