search
HomePHP FrameworkThinkPHPThinkPHP5 custom paging URL

ThinkPHP5 custom paging URL

Mar 21, 2020 am 09:50 AM
thinkphpurlPaginationcustomize

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);

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!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool