What should I do if the string parsed by php json_encode is garbled?
阿神
阿神 2017-05-31 10:33:50
0
2
871

For example,
$testStr = 'Hello, please help'; // It is in utf-8 format $testStr is a variable, so I don’t know if it is There is no garbled code, and the garbled code is somewhere, so the method of removing it by interception does not seem to work.

$testStr1 = json_encode($testStr);

var_dump($testStr1);

prints as false

It’s because there are garbled characters. How to parse the string with garbled characters? Please give me some advice. Thank you.

阿神
阿神

闭关修行中......

reply all(2)
Peter_Zhu

http://php.net/manual/zh/func...

左手右手慢动作

php’s json_encode transcoding arrays containing Chinese characters requires adding parameters, json_encode($array, JSON_UNESCAPED_UNICODE).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template