2016-07-22 114 views
0

我有刀片的elseif的,看起來像下面刀片ELSEIF條件語句結尾:做,如果滿足第一條件

@if(condition 1) 
    Something 1 
@elseif(condition 2) 
    Something 2 
@else 
    Something 3 
@endif 

如果第一個條件滿足的東西1發生,將語句完全結束,或者它也會碰到東西2,假設條件2被滿足

回答

0

第一個條件的主體將執行,然後它會結束。 如果你想檢查條件2,那麼你需要使它也是一個if以外的if if else系列。

0

如果else語句語句執行代碼中的兩個以上的條件下,它會是這樣不同:

@if (condition 1) 
    code to be executed only if this condition 1 is true; 
@elseif (condition 2) 
    code to be executed only if this condition 2 is true and condition 1 is false; 
@else 
    code to be executed if all conditions are false; 
@endif 

您可以瞭解更多的php if else w3school它類似於laravel刀模板。