练习一下blade模板的语法。如:变量渲染、foreach、if...else...2、include、section
blade模版引擎的用法主要有以下几个
if语句:
@if (count($records) === 1)
I have one record!@elseif (count($records) > 1)
I have multiple records!
@else
I don't have any records!
@endif
switch语句
@switch($i)
@case(1)
First case...
@break
@case(2)
Second case...
@break
@default
Default case...
@endswitch
for循环和foreach循环
@for ($i = 0; $i < 10; $i++)
The current value is {{ $i }}
@endfor
@foreach ($users as $user)
<p>This is user {{ $user->id }}</p>
@endforeach
引入子视图
@include('shared.errors')