abstract:父模板 base.html<block name='a'>abc</block><block name='1'>123</block><block name='啊'>啊啊啊</block>子模板 111.html{extend name="base" /}{b
父模板 base.html
<block name='a'>abc</block>
<block name='1'>123</block>
<block name='啊'>啊啊啊</block>
子模板 111.html
{extend name="base" /}
{block name="a"}{/block}
{block name="1"}456{/block}
{block name="啊"}{__block__}引用后的新内容{/block}
布局模板 layout.html
{include file="public/header" /}
{__CONTENT__}
{include file="public/footer" /}
add.html
主题内容
namespace app\index\controller;use think\Controller;
class User extends Controller{
public function add()
{
return $this->view->engine->layout(true)->fetch('index\add');
}
Correcting teacher:韦小宝Correction time:2019-02-22 13:50:36
Teacher's summary:写的很不错 模板继承在项目中会经常用到 有很多页面的头部基本上都是一样的 直接进行模板的调用就可以了 写一次调用多次