thinkphp Page Use example (21)

Source: Internet
Author: User

Original: thinkphp Page Use example (21)

thinkphp Paging Use

PHP Code:
Public function Fenye () {
$User = M (' Leyangjun ');//Instantiate User object
import (' ORG. Util.page ');//Import page-out class
$count = $User->count ();//query satisfies the required total number of records


$Page = new Page ($count, 2);//Instantiate the total number of incoming records for the paging class and the number of records displayed per page

$show = $Page->show ();//pagination display output


Querying for paging data note the parameters of the limit method to use the properties of the page class
$list = $User->limit ($Page->firstrow. ', '. $Page->listrows)->select ();
$this->assign (' list ', $list);//Assignment Data set
$this->assign (' page ', $show);//Assignment Paging output
$this->display (); Output template
}

HTML page:
<div>
<foreach name= ' list ' item= ' Vo ' >
id:<{$vo. id}>--Name: <{$vo. name}>--Age <{$vo .age}></foreach>
<{$page}>
</div>

thinkphp Page Use example (21)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.