Home  >  Article  >  Backend Development  >  结合 thinkPHP 分页写成自己分页类_PHP教程

结合 thinkPHP 分页写成自己分页类_PHP教程

WBOY
WBOYOriginal
2016-07-20 11:13:59978browse




// +----------------------------------------------------------------------
// $Id: page.class.php  2013-05-26 00:08:49

 (); 

 ; 
     ; 
     ; 
     ; 
     ; 
     ;  
     ; 
     ;
     ;
      = ;  
    
      = 'header'=>'条记录','prev'=>'上一页','next'=>'下一页','first'=>'首页','last'=>'尾页',
        'theme' => '%records% %header% %page%/%pageMax% 页  %firstPage%%prevPage%%linkPage%%nextPage%%lastPage%'
     
     __construct(, ,  = 'p',  = ->records = ->pageMax = (/->page= (([]), 1); 
        ->page = (->page, ->pageMax); 
        ->nextPage = ->page + 1->prevPage = ->page - 1->varPage = ; 
        ->parameter = ; 

     setConfig(, ((->config[->config[] = 
     show(,  = (0 == ->records)  ''(->url)? ->url = ['REQUEST_URI'] :  = ->url.((->url,'?')?'':'?').-> = (((['query'(['query'],([-> = ['path'].'?'.(('mid' == ->style){ 
            ( % 2 != 0 = ( / 2 =  - 1 ;
            } =  =  / 2 = - 1;  
            ->startPage = (->page  + ) > ->pageMax ? ->pageMax  -  : ->page - ->endPage = (->page < )?  : ->page + { 
            ->startPage = (->page >= )? ['startPage'] : 1->endPage  = ->startPage +  - 1->lastPage =  (['lastPage'])? ['lastPage'] : 1; 
            ['lastPage'] = ->page;  
             
            (->lastPage < ->page){ 
                (->page >= ->->startPage = ['startPage'] = ->->endPage = ->startPage +  -1(->lastPage == ->page){
                (->page == ->->startPage = ['startPage'] = ->->endPage = ->startPage +  -1->startPage = ['startPage'] = ->page -  + 1->endPage = ->startPage +  -1{
                (->page == ->->startPage = ['startPage'] = ->page -  + 1->endPage = ->startPage +  -1startPage.'
'; //echo '上次页码:'. $this->lastPage.'
';
->startPage = (->pageMax - + 1, ->startPage); ->startPage = (->startPage, 1); ->endPage = ->startPage + -1->endPage = (->pageMax, ->endPage); ['startPage'] = ->startPage; startPage.'
'; //echo '上次页码:'. $this->lastPage.'
';
(->page <= 1){ = ''.->config['first'].'' = ''.->config['prev'].'' = "".->config['first'].'' = "".->config['prev'].''(->page >= ->pageMax){ = ''.->config['next'].'' = ''.->config['last'].'' = "".->config['last'].'' = "".->config['next'].''(){ (->nextPage >= ->pageMax)? = '' : ->prevPage < 1)? = '' : ( = ->startPage; <= ->endPage; ++ (->page == .= "" .= "" = ('%records%','%header%','%page%','%pageMax%','%firstPage%','%prevPage%','%linkPage%','%nextPage%','%lastPage%' = (->records,->config['header'],->page,->pageMax,,,,, = (, , ->config['theme' = Page(340, 10 = '%records% %header% %page%/%pageMax% 页 %firstPage%%prevPage%%linkPage%%nextPage%%lastPage%'->setConfig('theme',); ->setConfig('last','末页'); ->url = 'http://localhost/test.php' ->show(10?>

 



 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440334.htmlTechArticle? (); ; ; ; ; ; ; ; ; ; = ; = 'header'='条记录','prev'='上一页','next'='下一页','first'='首页','last'='尾页', 'theme' = '%records% %header% %page%/%pageMax% 页 %first...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn