In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how php converts json data into utf8". In daily operation, I believe many people have doubts about how php converts json data into utf8. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "php how to convert json data into utf8". Next, please follow the editor to study!
Php converts json data into utf8: 1, create a PHP sample file; 2, save the json array as utf8 through "json_encode ($xm_json,JSON_UNESCAPED_UNICODE);"
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
How does php convert json data into utf8?
Php json is saved as utf8
Json_encode ($xm_json,JSON_UNESCAPED_UNICODE); / / Save the json array as utf8
The json saved by php json_encode is utf8
Json_encode
(PHP 5 > = 5.2.0, PHP 7, PHP 8, PECL json > = 1.2.0)
Json_encode-JSON encoding of variables
Description
Json_encode (mixed $value, int $options = 0, int $depth = 512): string | false
Returns a string containing the JSON representation of the value value.
The encoding is affected by the passed-in options parameters, and the encoding of floating-point values depends on serialize_precision.
Parameters.
Value
The value to be encoded can be any data type except the resource type.
All string data must be encoded as UTF-8.
Note:
PHP implements a superset of JSON, refer to »RFC 7159.
Options
A binary mask consisting of the following constants: JSON_FORCE_OBJECT, JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_INVALID_UTF8_IGNORE, JSON_INVALID_UTF8_SUBSTITUTE, JSON_NUMERIC_CHECK, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRESERVE_ZERO_FRACTION, JSON_PRETTY_PRINT, JSON_UNESCAPED_LINE_TERMINATORS, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE, JSON_THROW_ON_ERROR. For more information about JSON constants, please see the JSON constants page.
Depth
Sets the maximum depth. Must be greater than 0.
Return value
Returns JSON-encoded string on success or false on failure.
At this point, the study on "how php converts json data into utf8" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.