Home > Backend Development > PHP Problem > What to do if php request is garbled

What to do if php request is garbled

藏色散人
Release: 2023-03-06 08:36:02
Original
2397 people have browsed it

Solution to garbled php request: First open the corresponding code file; then change the encoding through the "mb_convert_encoding($_GET['v'], "UTF-8", "gb2312");" statement .

What to do if php request is garbled

Recommendation: "PHP Video Tutorial"

Specific questions:

php request Chinese characters are garbled

There is a form submitted to a.php

../a.php?v=China

The printed result , is China garbled? How to solve it?

The encoding of the document is charset=gb2312

My server is a US server, mainly UTF-8

Solution:

Code such as:

$str = mb_convert_encoding($_GET['v'], "UTF-8", "gb2312");
Copy after login

The above is the detailed content of What to do if php request is garbled. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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