Bla*_*ack 6 laravel laravel-blade
我需要检查数据数组是否有特定的密钥,我试过这样:
@if ( ! empty($data['currentOffset']) )
<p>Current Offset: {{ $currentOffset }} </p>
@else
<p>The key `currentOffset` is not in the data array</p>
@endif
Run Code Online (Sandbox Code Playgroud)
但我总是得到<p>The keycurrentOffset is not in the data array</p>.
Ale*_*nin 12
你可以使用@isset:
@isset($data['currentOffset'])
{{-- currentOffset exists --}}
@endisset
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6768 次 |
| 最近记录: |