Although the limit parameter of each page can be automatically calculated by using the paging class Page in the extended class library, But if you want to write it yourself, it will be more laborious. If you use the page method to write it, it will be much simpler, for example:
Obviously, using the page method you do not need to calculate the starting position of each paged data, It will be automatically calculated internally in the page method. Since version 3.1, the page method also supports two parameters, for example:
equivalent. The page method can also be used in conjunction with the limit method, for example:
When the page method only has one value passed in, it means the first Several pages, and the limit method is used to set the number displayed on each page, that is, the above writing method is equivalent to:
|