这是一款php分页代码是一款经典的可自动判断url参数再进行分页的实例代码,同时自定了上页,下页,首页,尾页,同时还支持select下拉框跳转代码.
php 经典的分页代码类代码如下:
-
class page{
-
-
var $page_name="page";
-
-
var $next_page='下一页';
-
-
var $pre_page='上一页';
-
-
var $first_page='首页';
-
-
var $last_page='尾页';
-
-
var $pre_bar='<<';
-
-
var $next_bar='>>';
-
-
var $format_left='';
-
-
var $format_right='';
-
-
var $pagebarnum=5;
-
-
var $totalpage=0;
-
-
var $nowindex=1;
-
-
var $url="";
-
-
var $offset=0;
-
-
var $rewrite = array();
-
-
-
function page($array)
-
-
{
-
-
if(is_array($array)){
-
-
if(!array_key_exists('total',$array))$this->error(__function__,'need a param of total');
-
-
$total=intval($array['total']);
-
-
$perpage=(array_key_exists('perpage',$array))?intval($array['perpage']):10;
-
-
$nowindex=(array_key_exists('nowindex',$array))?intval($array['nowindex']):'';
-
-
$url=(array_key_exists('url',$array))?$array['url']:'';
-
-
$action = (array_key_exists('action', $array)) ? $array['action'] : '';
-
$id0 = (array_key_exists('id0', $array)) ? $array['id0'] : '';
-
$id1 = (array_key_exists('id1', $array)) ? $array['id1'] : '';
-
$id2 = (array_key_exists('id2', $array)) ? $array['id2'] : '';
-
$id3 = (array_key_exists('id3', $array)) ? $array['id3'] : '';
-
-
}else{
-
-
$total=$array;
-
-
$perpage=10;
-