Home > Backend Development > PHP Tutorial > 143 php interface

143 php interface

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:01:11
Original
1160 people have browsed it

php Write app interface


php interface

  • Special abstract class
  • interface / implements keyword
  • implement interface All abstract methods of the interface must be implemented

app interface


definition

  • There is an interface address to allow the client to send a request (http://xxx/api.php?format=xml)
  • There is an interface file (api.php) to obtain the interface logic
  • interface data,

app communication

client -> (http request to interface address) -> serivice

The difference from b/s architecture

  • The address is encapsulated in the app (different from the browser address visible)
  • The client returns xml Or json data (different from html)

xml (extensible markup language) and json (JavaScript object notation)

cross platforms and languages.

  • Readability->
  • SimpleXml


  • Efficiency-> json

    • encapsulated data interface method
    • json
    • json_encode only accepts utf-8
    • Transcode iconv("UTF-8","GBK",$data)
    xml
  • header("Content-Type: text/xml");

DomDocument

* createElement

* appendChild

standard format of communication data

status code (200 400)

prompt information (login successful)

data


core technology

').addClass('pre-numbering'). hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i

').text(i)); }; $numbering.fadeIn(1700); }); });
  • The above introduces the 143 php interface, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Backslash present in Json
From 1970-01-01 08:00:00
0
0
0
Get: Transfer JSON data
From 1970-01-01 08:00:00
0
0
0
mysql storage json error
From 1970-01-01 08:00:00
0
0
0
javascript - Problems with displaying json data
From 1970-01-01 08:00:00
0
0
0
Find matching integers in JSON.
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template