Html:
Php:
prepare($sql); $sth->bindParam(':username', $user_name); // $sth->bindParam(':pwd', $up); $sth->execute(); $rs = $sth->fetchAll(PDO::FETCH_ASSOC); return $rs;}?>
Received user_name is garbled, here is the need to set the post headers? How it should be set.
For a variety of reasons, you need to maximize compatibility with previous systems, so use gb2312.
Reply content:
Html:
Php:
prepare($sql); $sth->bindParam(':username', $user_name); // $sth->bindParam(':pwd', $up); $sth->execute(); $rs = $sth->fetchAll(PDO::FETCH_ASSOC); return $rs;}?>
Received user_name is garbled, here is the need to set the post headers? How it should be set.
For a variety of reasons, you need to maximize compatibility with previous systems, so use gb2312.
Can I paste the HTTP message of the POST request,
Should be able to receive the first time to receive with UTF-8, and then to store or interact with other services on the server to gb2312, usingiconv()
@ Li Mingxing engraved with blog post Http://blog.csdn.net/vera_xue ...
I used the following code in PHP to solve the problem:
$params = Json_decode (file_get_contents (' Php://input '), true);
Require ("cfg.php");
Global $DBH;
$user _name = $params ["uname"];//utf-8
$user _name = Iconv ("UTF-8", "GB2312", $user _name);