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

What to do if php request is garbled

藏色散人
藏色散人Original
2020-09-29 09:06:452307browse

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

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!

Statement:
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