1.

点击(此处)折叠或打开

public function index(){
$where = 'TRUE';
$membersModel = new Model("Members");

//分页
import('ORG.Util.Page');// 导入分页类
$count = $membersModel->where($where)->count();// 查询满足要求的总记录数
$Page = new Page($count,1);// 实例化分页类 传入总记录数和每页显示的记录数
$show = $Page->show();// 分页显示输出
// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
$rows = $membersModel->where($where)->limit($Page->firstRow.','.$Page->listRows)->select();
// $this->assign('list',$rows);//



// if($rows){
// import('ORG.Net.IpLocation');// 导入IpLocation类
// $Ip = new IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件。下载dat文件到net目录下
// foreach ($rows as $k=>$v){
// $area = $Ip->getlocation($v['regIP']);
// $rows[$k]['location'] = isset($area['country'])?$area['country']:'未知地址';// 获取某个IP地址所在的位置
// }
// }
$this->assign('rows',$rows);
$this->assign('page',$show);// 赋值分页输出

$this->display();
} 2.

点击(此处)折叠或打开

<tr>
<td colspan="6">{$page}</td>
</tr>