用tp3.2写分页 手册上说的好难懂,我自己去网上找资料 ,现在整理一下,以后可能会用;
在Think下面有Page.class.php类;
我在
这个下面放了一个function.php的(算是类吧又不是..)文件;
目的:方便其他地方调用;
看源码:这是function.php里的代码:
立即学习“PHP免费学习笔记(深入)”;
setConfig('header', '在控制其中怎么用呢?:
public function fy() {
$m = M('article');
$where = "a_id>10";
$count = $m->where($where)->count();
$p = getpage($count,10);//每页显示几条
$list = $m->field(true)->where($where)->order('a_id')->limit($p->firstRow, $p->listRows)->select();
$this->assign('select', $list); // 赋值数据集
$this->assign('page', $p->show()); // 赋值分页输出
$this->display('Ws:public/fy');
}再来看前端页面:
信息输出
| 编号 | 标题 | 描述 |
| {$user.a_id} | {$user.a_title} | {$user.a_remark} |
{$page} |
||











