How PHP generates JSON does not do unioncode encoding conversion
For example in json $a = [' name ' = ' Zhang San ', ' age ' =>20]; after Json_encode ' Zhang San ' will become
'/u97asfddd/' Such a code, how can the ' Zhang San ' not be converted to '/u/' such a code?
Reply content:
How PHP generates JSON does not do unioncode encoding conversion
For example in json $a = [' name ' = ' Zhang San ', ' age ' =>20]; after Json_encode ' Zhang San ' will become
'/u97asfddd/' Such a code, how can the ' Zhang San ' not be converted to '/u/' such a code?
Json_unescaped_unicode requires more than php5.4 version to be used
PHPfunction json_encode_wrapper ($result){ if(defined('JSON_UNESCAPED_UNICODE')){ return json_encode($result,JSON_UNESCAPED_UNICODE|JSON_NUMERIC_CHECK); }else { return preg_replace( array("#\\\u([0-9a-f][0-9a-f][0-9a-f][0-9a-f])#ie", "/\"(\d+)\"/",), array("iconv('UCS-2', 'UTF-8', pack('H4', '\\1'))", "\\1"), json_encode($result) ); }}
Http://php.net/json_encode
echo json_encode($arr, JSON_UNESCAPED_UNICODE);