PhpAndroid usage overview JSONXML differences _ PHP Tutorial

Source: Internet
Author: User
Differences between JSONXML and phpAndroid. PhpAndroid usage overview JSONXML differences one app communication interface three elements: 1. interface address :( app. comapi. php? Formatxml) 2. interface file: (api. php handles some business logic php Android usage introduction json xml differences
Three elements of an app communication interface:
1. interface address (http://app.com/api.php? Format = xml)
2. interface file: (api. php processes some business logic)
3. Interface communication data


How the App communicates
1. The App sends an http request to the server
2. the server returns data to the App after processing
Different from B/s access:
The address for accessing the server page in B/s mode can be seen in the address bar, but the address cannot be seen during app access, which has been encapsulated.
In B/s mode, the returned data is usually html, and the data format and JSON and XML


JSON and XML
XML: Extensible Markup Language, which can be used to mark data and define data types.


SOURCE language that allows you to define your own markup language.
Features: XML can be customized by nodes and cross-platform.

Root node
Name



JSON (JavaScript Object Notation) is a lightweight data exchange format with good readability and convenience.


Fast writing feature. Data exchange can be performed between different platforms. JSON is highly compatible and completely independent from the language text lattice.


. These features make JSON an ideal data exchange language.


First, parse the string: "s" (It is not easy to understand with this format)
Second, parse the array {"title": "david", "from": "qingdao", "decrip": "hello"} (key: value


For understanding, so this is often used)


Differences between xml and json:
1. readability: the xml structure is clear, and the json output is similar to a string, so the xml is readable.
2. php Data Generation: How does php generate json data: json_encode ($ arr );
How to generate xml data: encapsulate multiple strings and output them together.
Json only uses one function, which is very convenient;
3. transmission speed:
Json has no tags, and the data size is small, so the transmission speed is fast.


App interface function:
1. get data: obtain data from the database or cache, and then return the data to the client through the interface. For example, add data on the main interface


.
2. submit data: (get post), submit data to the server through the interface, and then the server enters the database for processing, or other operations. Class


Similar to submitting forms on the web. For more information, see feedback.


Version Upgrade interface: submit the data of the current version to determine whether to update the data.

Http://www.bkjia.com/PHPjc/927609.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/927609.htmlTechArticlephp Android use introduction json xml difference 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...

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.