<?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