PHP JSON interface transcoding problem? I don't know what's wrong, it's garbled.

Source: Internet
Author: User
Tags php json
{"appid":"assdf","appsecret":"56d0626167e58ee3770021b6","itemdata":{"nType":"1","nBaoYou":"0","szItemId":"520361590788","title":"韩版夏季韩国大码无袖T恤宽松短裤女休闲学生跑步运动套装两件套","secondTitle":"","imgURL":"http:\/\/img4.tbcdn.cn\/tfscom\/i1\/TB1wJnVIpXXXXcHXFXXXXXXXXXX_!!0-item_pic.jpg","promotionTxt":"继续狂欢节","fOldPrice":"58","fThirdPrice":"19.9","fCommissionPer":"12.3","fCommission":"2.45","nTgCount":"1","nSellCount":"-1","fPingFen":"-1","nPingjiaCount":"-1","szTgURL":"http:\/\/s.click.taobao.com\/NT7PEcx","szWebTgURL":"","szBlogTgURL":"","shortUrl":"http:\/\/s.click.taobao.com\/NT7PEcx","szDesc":""}\r\n}

This is the echo from the PHP side. But it's like this? Do not know where the decoding error, the Chinese to decode out, but the quotation marks seem to have become something else, the idea is more vague, hope to do the people give a clear idea

Reply content:

{"appid":"assdf","appsecret":"56d0626167e58ee3770021b6","itemdata":{"nType":"1","nBaoYou":"0","szItemId":"520361590788","title":"韩版夏季韩国大码无袖T恤宽松短裤女休闲学生跑步运动套装两件套","secondTitle":"","imgURL":"http:\/\/img4.tbcdn.cn\/tfscom\/i1\/TB1wJnVIpXXXXcHXFXXXXXXXXXX_!!0-item_pic.jpg","promotionTxt":"继续狂欢节","fOldPrice":"58","fThirdPrice":"19.9","fCommissionPer":"12.3","fCommission":"2.45","nTgCount":"1","nSellCount":"-1","fPingFen":"-1","nPingjiaCount":"-1","szTgURL":"http:\/\/s.click.taobao.com\/NT7PEcx","szWebTgURL":"","szBlogTgURL":"","shortUrl":"http:\/\/s.click.taobao.com\/NT7PEcx","szDesc":""}\r\n}

This is the echo from the PHP side. But it's like this? Do not know where the decoding error, the Chinese to decode out, but the quotation marks seem to have become something else, the idea is more vague, hope to do the people give a clear idea

Json_encode Add a second parameter, json_unescaped_slashes| Json_unescaped_unicode, all escapes and Chinese characters can remain unchanged

is the Json_encode () function used to turn the array into JSON?

Just another. Double quotes turn into ' & quot; '

You don't sign escape until you're json_encode.
The contents should be escaped in the array, and then Json_encode

What was the data like before Json_encode?

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.