Laravel: How to write href attribute based on if-else condition?
P粉852578075
2023-08-31 17:37:25
<p>我需要在 if-else 子句中通过 URL 检查“perPage=100”和“perPage=50”。</p>
<pre class="brush:php;toolbar:false;">@if(perPage=100)
<a class="btn btn-default btn-sm ajax-link back-btn" href="invoice-list?perPage=100" type="button" >Back to List</a>
@elseif(perPage=50)
<a class="btn btn-default btn-sm ajax-link back-btn" href="invoice-list?perPage=50" type="button" >Back to List</a>
@else
<a class="btn btn-default btn-sm ajax-link back-btn" href="invoice-list?perPage=10" type="button" >Back to List</a>
@endif</pre></p>
You can only write this line without any if:
Make sure you have the $perPage variable