<?php $counter = 0 ?>
<table>
<?php foreach($attributes as $a): ?>
<tr>
<td><?php $a['name']?></td>
<td><?php $a['Price']?></td>
</tr>
<?php $counter++;
if ($counter > 3) ?> <!-- What to do here? -->
<?php endforeach; ?>
</table>
在一個PHP代碼塊這樣的,我想經過三個TR弄到一個閱讀更多按鈕元素,當我點擊該按鈕顯示元件的所有休息...如何在表格中創建Read More按鈕?
事做用PHP?
你可以使用ajax來做到這一點。點擊該按鈕(閱讀更多)使用ajax調用添加新的trs。點擊此鏈接:[/load-more-data-using-jquery-ajax-php-from-database](http://www.codexworld.com/load-more-data-using-jquery-ajax-php- from-database /)這是一個加載/從數據庫讀取更多數據並將其放入html中的示例。 – Bhavin