1. 父模板中用到的关键字:
section -> 可以包含一些内容,这些内容页可以被子模板继承
yield -> 相当于一个占位符,在父模板中可以不定义任何内容, 如果定义了内容,子模版如果没有对应的定义,则显示父模板,如果有定义,则显示子模版
2. 子模版继承时,首行需要使用关键字 extentds 继承父模板
3. 子模版重写时,用到的关键字:
3-1. 重写section:
其中@parent为父模板中的内容
@section('header')
@parent
new_content
@stop
3-2 重写yield:
@section('content')
new content
@stop
一个例子:
父模板:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"