要获得真正干净的 JSON 字符串,请按如下所示使用这三个常量
<?php
$array = ['€', 'http://example.com/some/cool/page', '337'];
$bad = json_encode($array);
$good = json_encode($array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
// $bad 将是 ["\u20ac","http:\/\/example.com\/some\/cool\/page","337"]
// $good 将是 ["€","http://example.com/some/cool/page",337]
?>