Json.dumps (), use of json.dump,json.loads,json.loadImportJsond1= [1, 2,'ABC', {'name':'s',' Age': 18}]d2= {'b': None,'a': 1,'C':'cc'}" "dumps () differs from dump () in that the interface is different, and dump () is a write operation to the file" "Printjson.dumps (D1)PrintJson.dumps (D2)PrintJson.dumps (D2, separators=[',',':'])PrintJson.dumps (D2, sort_keys=True) with open ('Jsonname.json','WB') as F:json.dump (D2, F)" "loads () differs from load () in that the interface is different, and loa
This article is mainly for you to share a PHP read local JSON file instance, has a good reference value, I hope to help you. Follow the small series together to see it, hope to help everyone.
{"Goods": [{"Type": 1, "name": "Wow featured", "Product": [{"id": 98, "name": "Leather Coat", "title": "Single barrel original whisky Spring gift Box Limited exclusive", "Titledesc": " Scottish maltose, China Custom
The HTML is as follows:Name: Age:Php:$string = file_get_contents ("Php://input");$res = Json_decode ($string, true);echo Json_encode ($res);?>Submitted in Application/json and then used in PHP to read the raw data stream in the way obtained in Json_encode
PHP and Web pages use UTF-8 encoding, the database is SQL server2008, using the default encoding (936, which is GBK encoding)
When reading the database data, use PHP's own json_encode () to return to the front end, the result Chinese is not displayed.
The solution is as follows:
In this way, the Chinese in SQL Server 2008 can be displayed correctly on the Web page.
If you want to insert Chinese correctly into SQL Server 2008, add a code: $query = Iconv ("Utf-8", "Gbk//ignore", $query);//In ord
PHP and Web pages use UTF-8 encoding, the database is SQL server2008, using the default encoding (936, which is GBK encoding)
When reading the database data, use PHP's own json_encode () to return to the front end, the result Chinese is not displayed.
The solution is as follows:
In this way, the Chinese in SQL Server 2008 can be displayed correctly on the Web page.
If you want to insert Chinese correctly into SQL Server 2008, add a code: $query = Iconv ("Utf-8", "Gbk//ignore", $query);//In ord
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.