php Post value transmission garbled solution: 1. Encode before transmission and decode after transmission; 2. Use "iconv('UTF-8′,'GB18030′,$_GET["name "])" to decode.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
What should I do if the php post value is garbled?
GET and POST Chinese transmission garbled characters in PHP
Method 1:
Encoding before transmission
$ChineseName="我的名字,是中文的哦"; $EncodeStr=urlencode($ChineseName); echo "<a href=deal/dealLogin.php?name=$EncodeStr>我的名字</a>";
Decoding after transmission
echo urldecode($_GET["name"]);
Method 2:
Use iconv('UTF-8′,'GB18030′,$_GET["name"]) to decode
Recommended learning: "PHP Video Tutorial 》
The above is the detailed content of What to do if the value passed in php post is garbled. For more information, please follow other related articles on the PHP Chinese website!