簡體   English   中英

在刀片模板中聲明變量

[英]Declaring variables in blade template

我在刀片模板中定義了變量,但是它不起作用。 我沒有任何價值。 該列為空白。

<thead style='background-color:silver'><tr><td>S.N.</td><td>Name</td><td>Telephone No.</td><td>Mobile No.</td><td width="24%">Options</td></tr></thead>
<?php $i=1;?>
@foreach ($lists as $li)
<tr><td><?php $i++;?></td><td>{{$li->Name}}</td><td>{{$li->Telephone}}</td><td>{{$li->mobile}}</td>
<td><a href="{{url("/telephone/show/{$li->id}")}}"><button>View details</button></a>
<a href="{{url("/telephone/edit/{$li->id}")}}"><button>Edit</button></a>
<a href="{{url("/telephone/delete/{$li->id}")}}"><button>Delete</button></a></td></tr>
@endforeach
{!! $lists->render() !!}

這段代碼肯定會起作用:

<?php $i = 1; ?>
....
<?php $i++; ?>
....
{{-- This will output 2 --}}
{{ $i }}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM