W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
您可以使用 @if
, @elseif
, @else
和 @endif
指令構(gòu)造 if
語句。這些指令功能與它們所對應的 PHP 語句完全一致:
@if (count($records) === 1)
I have one record!
@elseif (count($records) > 1)
I have multiple records!
@else
I don't have any records!
@endif
為了方便, Blade 還提供了一個 @unless
指令:
@unless (Auth::check())
You are not signed in.
@endunless
除了已經(jīng)討論過了的條件指令外, @isset
和 @empty
指令亦可作為它們所對應的 PHP 函數(shù)的快捷方式:
@isset($records)
// $records 已經(jīng)定義但不為空
@endisset
@empty($records)
// $records 為空……
@endempty
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: