Let JSON understand Chinese (json_unescaped_unicode) _php Tutorial

Source: Internet
Author: User
Copy CodeThe code is as follows:
Echo Json_encode ("Chinese"); "\u4e2d\u6587"

This let us do in the celestial development of the classmate, is a headache, and sometimes have to write their own json_encode.

In PHP5.4, the problem is finally resolved, JSON added an option: Json_unescaped_unicode, so the name Incredibles, that is, JSON do not encode UNICODE.

Look at the following example:
Copy CodeThe code is as follows:
Echo Json_encode ("Chinese", Json_unescaped_unicode); Chinese


How, is not let everybody very happy change? Hehe, of course, JSON in 5.4 also joined: json_bigint_as_string, Json_pretty_print, json_unescaped_slashes and other options, if interested, you can see: Json_encode

However, it is still a reminder that PHP 5.4 is still in development, and any new features may be adjusted or changed before final release. If you have any suggestions, please also welcome feedback, help us make PHP better.
From: http://www.laruence.com

http://www.bkjia.com/PHPjc/324501.html www.bkjia.com true http://www.bkjia.com/PHPjc/324501.html techarticle Copy the code as follows: PHP echo Json_encode ("Chinese");//"\u4e2d\u6587" This let us do in the celestial development of the classmate, is a headache, and sometimes have to write their own json_e ...

  • 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.