search

Home  >  Q&A  >  body text

About the use of $parameter in the paging function of thinkphp3.2.3

I would like to ask those who know thinkphp, the paging function provided in the thinkphp3.2.3 document is as follows:
$User = M('User'); // Instantiate the User object
$count = $User->where('status=1')->count(); // Query the total number of records that meet the requirements
$Page = new ThinkPage($count,25); //Instantiate the paging class and pass in the total number of records and the number of records displayed on each page (25)
$show = $Page->show(); // Paging display output
// Perform paging data query Note that the parameters of the limit method must use the attributes of the Page class
$list = $User->where('status=1')->order('create_time')->limit($Page->firstRow.','.$Page->listRows)->select( );
$this->assign('list',$list); // Assign data set
$this->assign('page',$show); // Assign paging output
$this->display(); // Output template

I would like to ask, when I click on the next page, I can see that the value of p/2 is passed in the URL, but there is no relevant variable in this paging function to receive the value of p. Why is the function on the next page still valid?

仅有的幸福仅有的幸福2786 days ago429

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-05-16 13:11:35

    page.class.php in thinkphp core framework
    url https://github.com/top-think/...
    Line 22 That’s it

    reply
    0
  • 某草草

    某草草2017-05-16 13:11:35

    . . You need to chase this paging class. Page numbers should be handled in the paging class

    reply
    0
  • 怪我咯

    怪我咯2017-05-16 13:11:35

    This parameter is taken from the class you called

    reply
    0
  • Cancelreply