Blogger Information
Blog 26
fans 0
comment 3
visits 19630
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
blade模版引擎的语法-2019年11月5日
西门吃雪
Original
820 people have browsed it
练习一下blade模板的语法。如:变量渲染、foreach、if…else…2、include、section


if 语局

  1. @if (count($records) === 1)
  2. I have one record!
  3. @elseif (count($records) > 1)
  4. I have multiple records!
  5. @else
  6. I don't have any records!
  7. @endif

Switch 语句

  1. @switch($i)
  2. @case(1)
  3. First case...
  4. @break
  5. @case(2)
  6. Second case...
  7. @break
  8. @default
  9. Default case...
  10. @endswitch

注释

  1. {{-- 注释内容 --}}
  2. PHP代码声明
  3. @php
  4. //
  5. @endphp
  1. for循环和foreach循环
  2. @for ($i = 0; $i < 10; $i++)
  3. The current value is {{ $i }}
  4. @endfor
  5. @foreach ($users as $user)
  6. <p>This is user {{ $user->id }}</p>
  7. @endforeach
  8. 引入子视图
  9. @include('shared.errors')



Correction status:qualified

Teacher's comments:合格
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post