The interface returns data in xml or json.-PHP source code

Source: Internet
Author: User
Now that mobile terminals are emerging, interfaces must be used to transmit data for them in many places. Is it better to use xml or json? I personally think using json is a good choice. I will analyze from the following points: currently, mobile terminals are emerging, and interfaces must be used to transmit data for them in many places. Is it better to use xml or json? I personally think using json is a good choice. I will analyze the following points:

1. xml tags must be written in pairs, such

XXXXXX, while the json format is {"name": "XXX", "name": "XXX "},

Therefore, json significantly saves the transmission capacity.

2. json generation and data parsing are relatively simple. Taking php as an example, you only need to use a json_encode function to convert an array into json data, but the xml generation process is a little more troublesome.

3. json extension is more convenient, and the resolution speed is faster.

Therefore, there are no special rules in the project, so it is better to use json.

The above is the content that the interface returns data in xml or json. For more information, see PHP Chinese Network (www.php1.cn )!

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.