CI框架下的rest使用

2016-06-16  本文已影响184人  _伽蓝寺听雨声

1.配置本地hosts

2.配置虚拟机apache vhosts

3.配置虚拟机hosts

4.加载REST_Client.php和Curl.php

5.constans.php  => 

       $autoload['libraries']=array('uri','database','REST_Client');

       define('BASE_URL','http://home.loc');

      define('BLL_API_URL','http://newsbll.loc/index.php/');//业务逻辑层接口主机

6.   config.php  =>  $config['base_url'] = BASE_URL;

7.bll写方法并返回值

8.view层请求bll对应方法

$this->rest_client->initialize(array("server"=>BLL_API_URL));

$res = $this->rest_client->get();

上一篇 下一篇

猜你喜欢

热点阅读