laravel Blade 模板引擎 命令

来源:http://laravel-recipes.com/recipes/248/knowing-all-the-blade-template-commands

Knowing All the Blade Template Commands

  • {{ $var }} - Echo content
  • {{ $var or 'default' }} - Echo content with a default value
  • {{{ $var }}} - Echo escaped content
  • {{-- Comment --}} - A Blade comment
  • @extends('layout') - Extends a template with a layout
  • @if(condition) - Starts an if block
  • @else - Starts an else block
  • @elseif(condition) - Start a elseif block
  • @endif - Ends a if block
  • @foreach($list as $key => $val) - Starts a foreach block
  • @endforeach - Ends a foreach block
  • @for($i = 0; $i < 10; $i++) - Starts a for block
  • @endfor - Ends a for block
  • @while(condition) - Starts a while block
  • @endwhile - Ends a while block
  • @unless(condition) - Starts an unless block
  • @endunless - Ends an unless block
  • @include(file) - Includes another template
  • @include(file, ['var' => $val,...]) - Includes a template, passing new variables.
  • @each('file',$list,'item') - Renders a template on a collection
  • @each('file',$list,'item','empty') - Renders a template on a collection or a different template if collection is empty.
  • @yield('section') - Yields content of a section.
  • @show - Ends section and yields its content
  • @lang('message') - Outputs message from translation table
  • @choice('message', $count) - Outputs message with language pluralization
  • @section('name') - Starts a section
  • @stop - Ends section
  • @endsection - Ends section
  • @append - Ends section and appends it to existing of section of same name
  • @overwrite - Ends section, overwriting previous section of same name

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值