PHP ページング クラス、初めて実行します
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-07-25 09:05:56
第一次享、让大家踩踩
- @charset "utf-8";
- *{padding:0;margin:0;}
- .page {
- font-size: 14px;
- text-align:center
- }
- .page ul{list- style-type:none;display:table;margin-left:auto;margin-right:auto}
- .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;}
- .page .select{font-weight:bold;color:#000;font-size:14px;背景色:#F5F5F5;}
- .page li a{text-decoration:none;color:#333}
- .page .gray{color:#808080}
-
-
- class page{
- public $ページサイズ;
- public $pagecount;
- public $currentpage;
- public $pageurl;
- public $totalpage;
-
- function __construct($pagesize=15,$pagecount=0,$currentpage=1,$pageurl){
- $this- >pagesize = $pagesize;
- $this->pagecount = $pagecount;
- $this->currentpage = $currentpage;
- $this->pageurl = $pageurl;
- $this->totalpage = ceil( $this->pagecount / $this->pagesize);
- }
-
- function showpage(){
- $pagelink = "";
-
- $pagelink .= "
< ul>";
- // 第一页
- かどうか判断 if($this->currentpage==1){
- $pagelink .= "
- 最前页
";
- }else{
- $pagelink .= "
- 最前页
" ;
- }
-
- if($this->現在のページ > 1 && $this->合計ページ > 1){
- $prepage = $this->currentpage -1;
- $pagelink .= "
- 上一页
";
- }else{
- $pagelink .= "
- 上一页
";
- }
-
-
- // 判断页总数
- if($this->totalpage <= 11){
- $frompage = 1;
- $toppage = $this->totalpage;
- }else{
- if($this-> ;currentpage <= 6){
- $frompage = 1;
- $toppage = 11;
- }
- else if($this->currentpage > 6 && $this->totalpage - 6 > $this-> ;currentpage){
- $frompage = $this->currentpage - 5;
- $toppage = $this->currentpage + 5;
- }else{
- $frompage = $this->totalpage - 11;
- $toppage = $this->totalpage;
- }
- }
-
- for($i=$frompage;$i<=$toppage;$i++){
- if($i==$this->currentpage){
- $ pagelink .= "
- $i
";
- }else{
- $pagelink .= "
- pageurl ."p=$i">$i
";
- }
- }
- //最終面判断
- if($this->currentpage < $this->totalpage) {
- $nextpage = $this->currentpage + 1;
- $pagelink .= "
- 下一页
";
- }else{
- $pagelink .= "
- 下一页
";
- }
-
- if ($this->currentpage==$this->totalpage){
- $pagelink .= "
- 最終页
";
- }else{
- $pagelink . = "
- totalpage">最終页
";
- }
- $pagelink .="";
- $pagelink .="
";
- $pagelink .="
";
- return $pagelink;
- }
-
- }
-
-
- ?>
复制代
|
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
著者別の最新記事
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31