maltyxx/restclient

此软件包已被废弃,不再维护。未建议替代软件包。

Codeigniter 3的全功能REST客户端

v4.0.3 2018-10-18 12:53 UTC

This package is auto-updated.

Last update: 2021-01-28 12:30:42 UTC


README

Codeigniter 3的全功能REST客户端

要求

  • PHP 5.3.x (Composer要求)
  • CodeIgniter 3.x.x

安装

步骤1:通过Composer安装

运行composer

composer require maltyxx/restclient

步骤2:示例

控制器文件位于/application/controllers/Client.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Client extends CI_Controller
{
    public function index()
    {
        $this->load
            ->add_package_path(FCPATH.'vendor/restclient')
            ->library('restclient')
            ->remove_package_path(FCPATH.'vendor/restclient');

        $json = $this->restclient->post('https://my-super-webservice.com/ws', array(
            'lastname' => 'test'
        ));

        $this->restclient->debug();
    }
}