CnSwift - 雨燕

agile development - 敏捷开发

Laravel Blade模板引擎

Blade模板引擎

blade语法

1
2
3
4
{{$val}}
@{{$val}}
{{isset($val) ? $val : 'test'}}
{!! $str !!}

流程控制

@if

@unless

@foreach

@for

@forelse

@while

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@if($data['score'] > 60)
及格
@else
不及格
@endif
除非{条件成立}否则...
@unless($data['score'] > 60)
不及格
@endunless

@for($i = 0; $i < $data['num']; $i++)
{{$i}}<br/>
@endfor
@foreach($data['article'] as $value)
{{$value}}<br/>
@endforeach
@forelse($data['news'] as $value)
{{$value}}<br/>
@empty
暂无内容
@endforelse
@while($data['score'] > 60)
{{$data['score']}}
@endwhile
@foreach($data['article'] as $k => $v)
@if($k > 1)
{{$v}}<br/>
@endif
@endforeach
更多精彩内容,请关注公众号 Golang语言开发栈公众号二维码
感谢赞赏.

Welcome to my other publishing channels