Home > PHP Framework > ThinkPHP > body text

ThinkPHP5 custom paging URL

angryTom
Release: 2020-03-21 09:50:25
forward
3485 people have browsed it

This article introduces the method of implementing custom paging URL in ThinkPHP5. Most of the time, the paging that comes with TP5 cannot meet the development needs. At this time, we need to customize the paging URL.

ThinkPHP5 custom paging URL

ThinkPHP5 custom paging URL

When doing news or products, the URL often jumps with parameters, for example: www.xxx.com/redcm/news/newslist.html?classid=13

TP5’s own paging function, the default URL is like this: www.xxx.com/redcm/news/newslist.html? page=1

(Recommended tutorial: thinkphp tutorial)

So the paging that comes with TP5 cannot meet people’s normal use in most cases. We need to customize the paging url. The code is as follows:

ThinkPHP5 custom paging URL

The above is for viewing only, and the one here is for everyone to copy and paste~ ~

$where['query']['classid'] = $classid;
$newsList = Db::name('infolist')->where(['status' => 1,'classid' => $classid])->paginate(1,'',$where);
Copy after login

After adding this line of code, the paging url becomes: www.xxx.com/redcm/news/newslist.html?classid=13&page=2

So understand that the classid after query is What's up~ ~

PHP Chinese website, a large number of free high-definition website construction tutorials, welcome to learn online!

The above is the detailed content of ThinkPHP5 custom paging URL. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template