使用 PHP 的数据表

2021-12-28 00:00:00 php datatable

是否可以使用 PHP 编写数据表?

Is it possible to code a DataTable using PHP?

当在线搜索所有教程等都使用 ajax 时,我不太适应,所以只是想知道是否有一种方法可以只使用 PHP 来编写数据表 &如果是这样,有人有链接让我浏览吗?

When searching online all tutorials etc are using ajax, which I'm not to comfortable with so just wondering if there is a way of just using PHP to code a datatable & if so does anyone have a link for me to look through?

谢谢

推荐答案

尽管我完全同意您问题下方的评论!作为一种快速解决方法(没有学习曲线!)如果您的表格包含少于 10.000 行,您可以像您一样在 for/while 循环中简单地生成一个简单的 HTML 表格对于一个简单的表.然后像这样将表的 ID 传递给数据表:

Even though I totally agree with comments below your question! as a quick workaround (with no learning curve!) if your tables contain less than 10.000 rows you may simply generate a simple HTML table in a for / while loop as you would for a simple table. Then pass your table's ID to datatable like this:

$(document).ready(function() {
 $('#example').DataTable();
});

但毕竟,AJAX 的创建是为了让世界对我们更美好.:-)

But after all, AJAX is created to make world a better place for us. :-)

相关文章