How do you load third party package in Codeigniter?
This is elementary question.
I downloaded the Facebook PHP SDK and stored it in "third_party" folder within Codeigniter. I am hoping that is wher开发者_如何学Pythone it should go. But how do you load such PHP SDK?
Thanks
I ended up sticking in in CI's libraries directory and adding it to the libraries autoload in config/autoload.php
autoload.php:
$autoload['libraries'] = array('facebook');
Then, I made a small change to the Facebook implementation itself (constructor of the Facebook class) and added the keys to my app's config file:
public function __construct()
{
$ci =& get_instance();
$this->setAppId($ci->config->item('fb_appId'));
$this->setApiSecret($ci->config->item('fb_secret'));
$this->setCookieSupport($ci->config->item('fb_cookie'));
$this->setBaseDomain($ci->config->item('fb_domain'));
$this->setFileUploadSupport($ci->config->item('fb_upload'));
}
...And presto - you now have access to Facebook's API in your models and controllers via $this->facebook
精彩评论