1. php
//自定义分页2,
/**
* 首页 U('case/index', array('page'=>1))
* 上一页 $uppage
* 下一页 $nextpage
* 尾页 $lastpage = ceil($count/$size)
*/
// 1. 获取 当前的页数 $nowpage
$nowpage = I('get.page') ? I('get.page') : 1;
// 最大页码, 尾页
$lastpage = ceil($count / $size);
// 2. 上一页 当期页-1, 如果小于1, 默认为1
$uppage = ($nowpage - 1) <= 1 ? 1 : ($nowpage - 1);
//3. 下一页 当前页+1, 如果大于最大页码, 默认最大页码
$nextpage = ($nowpage + 1) >= $lastpage ? $lastpage : ($nowpage + 1);
//赋值
$this->assign('nowpage', $nowpage); //当前页
$this->assign('uppage', $uppage); //上一页
$this->assign('nextpage', $nextpage); //下一页
$this->assign('lastpage', $lastpage); //尾页
2. html
<style>
/*翻页*/
.zqpages{line-height:26px; text-align:center; white-space: nowrap; margin:15px 5px; clear:both; overflow: auto;}
.zqpages a, .zqpages a:visited{white-space: nowrap; display:inline-block; padding:0 8px; text-decoration:none!important; background-color:#f0f0f0; border:1px solid #DDD; color:#888; margin:2px; -moz-border-radius: 4px; border-radius: 4px;}
.zqpages a:hover{background-color: #ed182a!important;color: #fff !important;}
.zqpages a.link{color:#555!important;}
.zqpages a.link:hover{background-color: #ed182a!important;color: #fff !important;}
.pageNo{white-space: nowrap; display:block; float:left; padding:0 8px; text-decoration:none!important; background-color:#f0f0f0; border:1px solid #DDD; -moz-border-radius: 4px; border-radius: 4px; color:#888; margin:0 2px;}
.zqpages .nowpage,.zqpages .nowpage:hover{background-color: #ed182a!important;color: #fff!important;}
#page_select {white-space: nowrap; display:inline-block; padding:0 8px; text-decoration:none!important; border:1px solid #DDD; color:#888; margin:2px; -moz-border-radius: 4px; border-radius: 4px;height:28px;}
</style>
<div class="zqpages">
<a title="首页" href="{:U('case/index')}">首页</a>
<a title="上一页" href="__ACTION__?page={$uppage}">上一页</a>
<select id="page_select" onchange="window.location=this.value">
<for start="1" end="$lastpage+1">
<option <eq name="i" value="$nowpage">selected</eq> value="__ACTION__?page={$i}">第{$i}页</option>
</for>
</select>
<a title="下一页" href="__ACTION__?page={$nextpage}">下一页</a>
<a title="尾页" href="__ACTION__?page={$lastpage}">尾页</a>
</div>