php、mysql怎么对特别大的数据量进行分页
Jun 06, 2016 pm 08:22 PM
php怎么对特别大的数据量进行分页
回复内容:
php怎么对特别大的数据量进行分页
一般分页写法是:
1 2 |
|
不过当$offset很大时,速度会比较慢.
这时可以尝试使用"上一页"和"下一页"进行分页,比如:
60-41(上一页) 40-21(当前页) 20-01(下一页)
下一页(旧文章20篇):
1 2 |
|
上一页(新文章20篇):
1 2 3 |
|
得到的是升序ID序列,PHP使用array_reverse反转数组实现降序输出.
觉得负数不好看的话,可以额外加一个参数,比如:
page.php?action=next&id=21
page.php?action=prev&id=40
上面说了一个解决方案,我再说一个 延迟关联查询。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How to fix mysql_native_password not loaded errors on MySQL 8.4
