这个类是在网上找的,怎么用呀
<?php
class issPage {
//重写与否
var $rewrite= false ;
var $pvar;
//------分页设置-----------
function issPage($total,$pagesize=15,$current=false,$pvar = "page") {
$this->pvar=$pvar;
$this->total=$total;
$this->pageMax = ceil($total/$pagesize);//总页数
if (!$current) $current = empty($_GET[$this->pvar]) ? 1 : intval($_GET[$this->pvar]) ;
if ($current > $this->pageMax) $current = $this->pageMax;
if ($current < 1) $current = 1;
$this->curr = $current;//当前页面
$this->psize = $pagesize;//页面大小
$this->varstr='';
$this->output='';
}
//-----设置除$_GET外的追加变量---------
function setVar($data) {
foreach ($data as $k=>$v) {
$_GET[$k]=$v;
}
}
function output() {
$start = $this->curr-1;
if ($start<1) $start=1;
$end = $start+2;
if ($end > $this->pageMax)$end=$this->pageMax;
$pnext=($this->curr+1> $this->pageMax)? $this->pageMax:$this->curr+1;
if($this->pageMax>1){
$this->output='<form method="GET" class="issPage" onsubmit="subpage();return false">';
$this->output.=' <table border="0" cellpadding="0" cellspacing="0">';
$this->output.=' <tr>';
$this->output .=' <td class="page_count">'.$this->curr.'/'.$this->pageMax.'</td>';
$this->output .= ' <td class="page_content">';
$this->output .= ' <a id="page_prev" href='.$this->FormatUrl($this->curr-1).'>前一页</a>';
for ($i=$start; $i<=$end; $i++) {
if($this->curr == $i)$this->output .= '<span>'.$i.'</span>';
else $this->output .= ' <a href='.$this->FormatUrl($i).'>'.$i.'</a>';
}
$this->output .= ' <a id="page_next" href='.$this->FormatUrl($pnext).'>后一页</a>';
$this->output.=' </td>';
$this->output.=' <td class="page_cbg">';
$this->output.=' <input type="text" name="'.$this->pvar.'" id="'.$this->pvar.'" class="page_query"/>';
$this->output.=' </td>';
$this->output.=' <td class="page_cbg">';
$this->output.=' <input type="submit" value="GO" class="page_submit" />';
$this->output.=' </td>';
$page= new issPage();
?>
PHP分页支持post的类
答案:1 悬赏:0 手机版
解决时间 2021-04-27 04:36
- 提问者网友:遁入空寂
- 2021-04-26 10:22
最佳答案
- 五星知识达人网友:雪起风沙痕
- 2021-04-26 11:07
这个类不是通用的。
issPage(总页数,每页多少条,这个不明白,页码)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯