>  기사  >  php教程  >  ThinkPHP分页

ThinkPHP分页

WBOY
WBOY원래의
2016-06-13 10:44:34975검색

1.下载官方有例子的包,然后找到例子下面的Page例子。
2. 找到Page.class.php,复制到你自己的项目ThinkPHP/Lib/Think/Util下面。
3.
Php代码 
public function doPage(){ 
        //echo $_GET["p"]; 
        if(emptyempty($_GET["p"])) 
            $this->assign('p', 1); 
        else  
            $this->assign('p', $_GET["p"]); 
        $Nav = M("navigation"); 
        $count = $Nav->count(); 
        import("ORG.Util.Page"); 
        $p = new Page($count, 10); 
        $page = $p->show(); 
        $list = $Nav->order('Id ASC')->limit($p->firstRow.','.$p->listRows)->select(); 
         
        $this->assign('page', $page); 
        $this->assign("list",$list); 
    } 

4.
Php代码 

{$page}
 
               
                 
                   
                   
                   
                   
                   
                   
                   
                   
                 
                 
                     
                         
                           
 
                               
                               
                               
                               
                               
                               
                               
                               
                             
                         
                         
                           
 
                               
                               
                               
                               
                               
                               
                               
                               
                             
                         
                     
                 
             
ID描述路径备注级别父导航Id编辑删除
{$vo.Id}{$vo.description}{$vo.addr}{$vo.remarks}{$vo.level}{$vo.parsentId}EditDelete
{$vo.Id}{$vo.description}{$vo.addr}{$vo.remarks}{$vo.level}{$vo.parsentId}EditDelete
 
             
{$page}
 

作者“pyzheng”
 

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.