APP接口基础学习一

PHP面向对象思想

1.客户端发送http请求到达服务器

2.服务器做出响应返回数据(XML,JSON或者其他)到达客户端

XML与JSON 的区别

1.可读性:xml胜出

2.生成数据:json胜出

3.传输速度:json胜出

 

获取数据与提交数据

1.获取数据:从数据库或者缓存中获取数据,然后通过接口数据返回给客户端

2.提交数据:通过接口提交数据给服务器,然后服务器入库处理或者其他处理

接口一般示例如下:

<?php
header("Content-type:Text/html;charset=utf-8");
/**
*定义一个接口
*提供一个标准
*/
interface video{
    public function getVideos();
    public function getCount();
}

class movie implements video{
    public function getVideos(){
        echo 1;
    }

    public function getCount(){
        echo 2;
    }
}

movie::getVideos();
echo '<br/>';
movie::getCount();
?>


."".    ."",
|  |   /  /
|  |  /  /
|  | /  /
|  |/  ;-._
}  ` _/  / ;
|  /` ) /  /
| /  /_/\_/\
|/  /      |
(  ' \ '-  |
 \    `.  /
  |      |
  |      |

posted @ 2016-03-07 11:53  侠岚之弋痕夕  阅读(366)  评论(0编辑  收藏  举报
Where is the starting point, we don't have a choice, but the destination where we can pursue!