CI框架下的rest使用

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();

你可能感兴趣的:(CI框架下的rest使用)