Skip to content

Instantly share code, notes, and snippets.

@zx1986 zx1986/PHPList.php
Last active Nov 24, 2015

Embed
What would you like to do?
如何把第三方的 Class 包到 CodeIgniter Libraries 中,方便 CodeIgniter $CI->load->libraries
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class PHPList {
public function __construct($config = array())
{
if (!empty($config))
{
include_once('phpListRESTApiClient.php');
return new phpListRESTApiClient($config['api_url'], $config['id'], $config['pw']);
}
else
echo 'Need to initial with an array like: $config("api_url" => string, "id" => string, "pw" => string);'
}
}
/* End of file PHPList.php */
@crazylion

This comment has been minimized.

Copy link

crazylion commented Nov 24, 2015

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class PHPList {

  public function __construct($config = array())
  {
    if (!empty($config))
    {
      include_once('phpListRESTApiClient.php');
      $this->config=$config;
    }
    else
      echo 'Need to initial with an array like: $config("api_url" => string, "id" => string, "pw" => string);'
  }

public init(){
return new phpListRESTApiClient($this->config['api_url'], $this->config['id'], $this->config['pw']);
}
}
@zx1986

This comment has been minimized.

Copy link
Owner Author

zx1986 commented Nov 24, 2015

感謝大神賜教!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.