if elseif语句有三个条件,其中第二个条件在两个数Laravel之间

时间:2018-05-27 09:06:01

标签: php arrays laravel if-statement

我想根据Laravel视图刀片中的三个条件过滤结果。我写了这段代码,但没有给我正确的结果,因为我的第二个条件必须在两个数字之间。我的代码:

@foreach($post_array[$key] as $array)
    @if($array['diff'] <= 168)
        <td>{{ $count }}<td>
    @elseif($array['diff'] > (168) && (720))
        <td>{{ $count }}<td>
    @elseif($array['diff'] > 720)
        <td>{{ $count }}<td>
    @endif
@endforeach

1 个答案:

答案 0 :(得分:1)

@foreach($post_array[$key] as $array)
    @if($array['diff'] <= 168)
        <td>{{ $count }}<td>
    @elseif(($array['diff'] > 168) && ($array['diff'] < 720))
        <td>{{ $count }}<td>
    @elseif($array['diff'] > 720)
        <td>{{ $count }}<td>
    @endif
@endforeach