Solution to php urldecode garbled code: First open the corresponding PHP code file; then pass "$statuses[0]['Theme']=urlencode($statuses[0]['Theme']);" This method can solve the problem of garbled output.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php uses urlencode and urldecode to solve Chinese character garbled characters Problem
Sometimes Chinese characters are stored in the database and become garbled after being taken out. You can use the two functions urlencode and urldecode to solve this problem, for example:
$statuses=M('information_sheet')->where(array('Id'=>$newsid))->field('List_ID,Id,CreateDate,Theme,pic_urls')->find();
I The data in the fields List_ID, Id, CreateDate, Theme, and pic_urls were taken out from the table information_shee. The data in the Theme field is Chinese characters. If I don’t do any processing and directly output echo json_encode(), I will get garbled characters. It can be solved like this:
$statuses[0]['Theme']=urlencode($statuses[0]['Theme']);
Use urlencode to encode Chinese
The output is:
echo urldecode(json_encode($statuses));
Use urldecode to decode, that’s it Got the correct Chinese
[Recommended learning: "PHP Video Tutorial"]
The above is the detailed content of How to solve the problem of php urldecode garbled characters. 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

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
