PHP Android Usage Introduction JSON XML difference _php Tutorial

Source: Internet
Author: User

PHP Android Usage Introduction JSON XML differences


An app communication interface three elements:
1. Interface Address: (Http://app.com/api.php?format=xml)
2. Interface file: (api.php handles some business logic)
3. Interface Communication Data


How the App communicates
1.APP sending HTTP requests to the server
2. Return data to app after server processing
and b/s access different ways:
b/S Mode Access Server Page address can be seen in the Address bar and app access to see the address, has been encapsulated.
b/S mode return data is usually HTML, and the data format to be returned to the app and JSON and XML


JSON and XML
XML: Extensible Markup Language (extensible Markup Language), which can be used to tag data, define data types, is a


A source language that allows users to define their own markup language.
Features: XML can be node-customized, cross-platform.

root Node
Name



JSON (JavaScript Object Notation) is a lightweight data interchange format that provides good readability and facilitates fast


Fast-writing features. Data exchange between different platforms is possible. JSON is highly compatible and completely independent of the language text grid


Expression These features are JSON as the ideal data exchange language.


First, parse out the string: "S" (less in this format, not easy to understand)
Second, parse the array {"title": "David", "from": "Qingdao", "Decrip": "Hello"} (Key:value


To understand, so this is commonly used)


XML and JSON differences:
1. Readability: XML hierarchy is clear, JSON output is similar to string, so XML is good readability
2.php generating data aspects: How PHP generates JSON data: Json_encode ($arr);
How to generate XML data: encapsulates multiple strings and outputs them together.
JSON only uses a function, very convenient;
3. Transfer speed:
JSON has no tags, data is small, so the transmission is fast.


App interface Features:
1. Get the data: Get the data from the database or cache and then return it to the client through the interface data. Such as: main interface data plus


Contained
2. Submit data: (get Post), submit data through the interface to the server, and then the server inbound processing, or other operations. Class


Web-like submission form. such as comments and feedback.


Version Upgrade interface: submits the current version data to get more rows of data.

http://www.bkjia.com/PHPjc/927609.html www.bkjia.com true http://www.bkjia.com/PHPjc/927609.html techarticle PHP Android using introduction JSON XML distinguishes one app communication interface three elements: 1. Interface address: (http://app.com/api.php?format=xml) 2. Interface file: (api.php handles some business logic ...

  • Related Article

    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.