size+1:floor($pager_index/$pager_size)*$pager_size+1;
//当前显示页码的结束
$current_pager_end=($current_pager_start+$pager_size-1)>=$pager_num?$pager_num:($current_pager_start+$pager_size-1);
//添加跳转到上一层的html
if($pager_index>$pager_size)
{
$pager_arr[]=$this->get_a_html(self::format_url($url,$current_pager_start-1),"...");
}
//主体页码部分
for($i=$current_pager_start;$i<=$current_pager_end;$i++)
{
if($i!=$pager_index)
{
$pager_arr[]=$this->get_a_html(self::format_url($url,$i),$i);
}else{
//如果这个是当前页
$pager_arr[]=$this->get_span_html($i,$this->config["current_btn_class"]);
}
}
//添加下一层的html
if($pager_index<=($pager_num-$pager_num%$pager_size))
{
$pager_arr[]=$this->get_a_html(self::format_url($url,$current_pager_end+1),"...");
}
//添加后面两个按钮的html
if($this->config["show_last_btn"])
{
//如果当前的页码为最后一页 则last这两个按钮则会被禁用
$attr=$pager_index>=$pager_num?"disabled=disabled":"";
$pager_arr[]=$this->get_a_html(self::format_url($url,$pager_next),$this->config["next_btn_text"],$attr);
$pager_arr[]=$this->get_a_html(self::format_url($url,$pager_num),$this->config["last_btn_text"],$attr);
}
//添加跳转的html
if($this->config["show_jump"])
{
$patterns=array("/\{totle\}/","/\{size\}/","/\{goto\}/","/\{record\}/","/\{index\}/",);
$replacements=array(
$pager_num,
$pager_size,
"<input type=\"input\" id=\"jumpNum\" style=\"width:20px;\" name=\"jump\" value=\"".$pager_next."\" />\n",
$this->config["record_count"],
$this->config["pager_index"]
);
//替换特定的标签组成跳转
$pager_arr[]=preg_replace($patterns,$replacements,$this->config["jump_info_text"]);
$btn_text=$this->config[''jump_btn_text''];
$pager_arr[]="<a href=\"javascript:void(0);\" style=\"float:none;\" onclick=\"javascript:jump();\">".$this->config[''jump_btn_text'']."</a></span>\n";
$pager_arr[]=$this->get_jumpscript($url);
}
$pager_arr[]="</div>";
$this->config["pager_index"]=$pager_index;
return implode($pager_arr);
}
/*
*获取需要处理的url,支持重写配置,各种参数的url
*/
private function get_url()
{
//如果设置了允许url重写
if($this->config["enable_urlrewriting"])
{
//得到调用文件所在的url
$file_path="http://".
仿Aspnetpager的一个PHP分页类代码附源码下载_网学
仿Aspnetpager的一个PHP分页类代码附源码下载