/**
+----------------------------------------------------------
* boot分页函数
+----------------------------------------------------------
*
@param string $count, $item, $list, $p ,$action 总页数, 一页多少个, 显示多少个分页, 当前页数 ,获取操作信息
+----------------------------------------------------------
*
@return string 返回分页字符串
*/
function boot_page($count,$item,$list,$p,$action)
{// 最大页数
$max = ceil($count/$item);
if($max <= 1)
{
$page = "";
}
else
{// 首页
$page = '<li><a href="'.__ACTION__.$action.'1">«</a></li>';
// 显示的第一个
$start = $p - floor($list/2);
if($start <= 0)
{
$start = 1;
}
// 显示的最后一个
$stop = $p + floor($list/2);
if($stop > $max)
{
$stop = $max;
}
for($i = $start; $i <= $stop; $i++)
{
if($i == $p)
{
// 选中当前页
$page .= '<li class="active"><span>'.$i.'</span></li>';
}
else
{
$page .= '<li><a href="'.__ACTION__.$action.$i.'">'.$i.'</a></li>';
}
}
// 末页
$page .= '<li><a href="'.__ACTION__.$action.$max.'">»</a></li>';
}
return $page;
}
这个很不错