<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_23933"> 第一次分享,让大家踩踩 <div class="blockcode"> <div id="code_aUp"><ol> <li>@charset "utf-8";</li> <li>*{padding:0;margin:0;}</li> <li>.page {</li> <li> font-size: 14px;</li> <li> text-align:center</li> <li>}</li> <li>.page ul{list-style-type:none;display:table;margin-left:auto;margin-right:auto}</li> <li>.page ul li{min-width:20px;padding:5px;margin-left:3px;border:1px solid #CCC;text-align:center;float:left;*float:none;*display:inline;*zoom:1;}</li> <li>.page .select{font-weight:bold;color:#000;font-size:14px;background-color:#F5F5F5;}</li> <li>.page li a{text-decoration:none;color:#333}</li> <li>.page .gray{color:#808080}</li> <li> <li> <li> <?php <li>class page{</li> <li> public $pagesize;</li> <li> public $pagecount;</li> <li> public $currentpage;</li> <li> public $pageurl;</li> <li> public $totalpage;</li> <li> </li> <li> function __construct($pagesize=15,$pagecount=0,$currentpage=1,$pageurl){</li> <li> $this->pagesize = $pagesize;</li> <li> $this->pagecount = $pagecount;</li> <li> $this->currentpage = $currentpage;</li> <li> $this->pageurl = $pageurl;</li> <li> $this->totalpage = ceil($this->pagecount / $this->pagesize);</li> <li> }</li> <li> </li> <li> function showpage(){</li> <li> $pagelink = "";</li> <li> </li> <li> $pagelink .= "<div class="page"> <ul>";<li> //判断是否为第一页</li> <li> if($this->currentpage==1){</li> <li> $pagelink .= "</li> <li class="gray">最前页</li>";<li> }else{</li> <li> $pagelink .= "</li> <li><a href="%5C%22%24this-">pageurl"."p=1\">最前页</a></li>";<li> }</li> <li> </li> <li> if($this->currentpage > 1 && $this->totalpage > 1){</li> <li> $prepage = $this->currentpage -1;</li> <li> $pagelink .= "</li> <li><a href="%5C%22%24this-">pageurl"."p=".$prepage."\">上一页</a></li>";<li> }else{</li> <li> $pagelink .= "</li> <li class="gray">上一页</li>";<li> }</li> <li> </li> <li> </li> <li> //判断页总数</li> <li> if($this->totalpage $frompage = 1;</li> <li> $topage = $this->totalpage;</li> <li> }else{</li> <li> if($this->currentpage $frompage = 1;</li> <li> $topage = 11;</li> <li> }</li> <li> else if($this->currentpage > 6 && $this->totalpage - 6 > $this->currentpage){</li> <li> $frompage = $this->currentpage - 5;</li> <li> $topage = $this->currentpage + 5;</li> <li> }else{</li> <li> $frompage = $this->totalpage - 11;</li> <li> $topage = $this->totalpage;</li> <li> }</li> <li> }</li> <li> </li> <li> for($i=$frompage;$i if($i==$this->currentpage){</li> <li> $pagelink .= "</li> <li class='\"select\"'>$i</li>";<li> }else{</li> <li> $pagelink .= "</li> <li><a href="%5C%22%22.%24this-">pageurl."p=$i\">$i</a></li>";<li> }</li> <li> }</li> <li> //最后页面判断</li> <li> if($this->currentpage totalpage){</li> <li> $nextpage = $this->currentpage + 1;</li> <li> $pagelink .= "</li> <li><a href="%5C%22%24this-">pageurl"."p=".$nextpage."\">下一页</a></li>";<li> }else{</li> <li> $pagelink .= "</li> <li class="gray">下一页</li>";<li> }</li> <li> </li> <li> if($this->currentpage==$this->totalpage){</li> <li> $pagelink .= "</li> <li class="gray">最后页</li>";<li> }else{</li> <li> $pagelink .= "</li> <li class="gray"><a href="%5C%22%24this-">pageurl"."p=$this->totalpage\">最后页</a></li>";<li> }</li> <li> $pagelink .="</li> </ul>";<li> $pagelink .="<br clear='\"left\"'>";</li> <li> $pagelink .="</li> </div>";</li> <li> return $pagelink;</li> <li> }</li> <li> </li> <li> }</li> <li> <li> <li>?></li> </ol></div> <em onclick="copycode($('code_aUp'));">复制代码</em> </div> </td></tr></table> <div id="comment_23933" class="cm"> </div> <div id="post_rate_div_23933"></div> <br><br>