How to solve the problem of garbled characters in thinkphp pagination
The problem of garbled characters is due to problems in constructing URLs in the thinkphp paging class. Thinkphp's paging URLs use "/" to separate parameters. When passing data to In the URL, after the URL is encrypted, it will be garbled when passed for the second time. If we use "?" and "&" to separate the parameters, this problem will not occur.
So the content to be modified is thinkphp’s paging class file: /ThinkPHP/Extend/Library/ORG/Util/Page.class.php file.
The specific modified code is:
1. Add a custom function at the end of the thinkphp paging class file Page.class.php to replace the parameter separator in the URL. The function content is as follows:
private function clin_page_url($parameter){ $url = U(''); $url = str_replace('.html', '?', $url); foreach ($parameter as $key => $value) { $url .= $key.'='.$value.'&'; } $url = substr($url, 0,-1); return $url; }
Self-study PHP blog
2. Modify the final generated url
In line 99 of the Page.class.php file, replace the original
$url=U('',$parameter);
is modified to:
$url=$this->clin_page_url($parameter); // 生成标准的url
After these two steps of modification, the problem of thinkphp paging garbled characters can be solved.
Related references:thinkphp tutorial
The above is the detailed content of How to solve the problem of garbled characters in thinkphp pagination. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Chinese version
Chinese version, very easy to use
