I'm new to codeigniter, and I'm trying to integrate amazon's FPS into my page. There are a bunch of libraries and models that go with Amazon FPS, which I would need included to make the appropriate calls.
我是codeigniter的新手,我正在尝试将亚马逊的FPS整合到我的页面中。有一堆与亚马逊FPS一起使用的库和模型,我需要将其包括在内以进行适当的调用。
How do I include them in CodeIgniter?
如何将它们包含在CodeIgniter中?
I tried placing the entire Amazon folder inside the system/libraries directory, and then tried including libraries with $this->load->library( 'Amazon/FPS/Client' ); However, I run into problems with the relative path there, because Client.php contains the statement require_once ('Amazon/FPS/Interface.php'); ... which is in the same folder.
我尝试将整个Amazon文件夹放在system / libraries目录中,然后尝试将库包含在$ this-> load-> library('Amazon / FPS / Client')中;但是,我遇到了相对路径的问题,因为Client.php包含语句require_once('Amazon / FPS / Interface.php'); ...在同一个文件夹中。
There has to be a better way to do all this - can anyone please help?
必须有一个更好的方法来做这一切 - 任何人都可以帮助吗?
Thanks!!
谢谢!!
34
There is nothing stopping you from directly including classes and working with them however you would in a vanilla PHP setup. If it works in PHP it will work in CodeIgniter.
没有什么可以阻止你直接包括类和使用它们,但是你可以在一个普通的PHP设置中。如果它在PHP中工作,它将在CodeIgniter中工作。
include(APPPATH.'libraries/Amazon/FPS/Interface.php');
3
Peng Kong of a3m http://code.google.com/p/a3m/ has a nice way of doing it with plugins:
a3m的Peng Kong http://code.google.com/p/a3m/有一个很好的插件方式:
Example twitter_pi.php
示例twitter_pi.php
require_once(APPPATH.'modules/account/plugins/libraries/jmathai-twitter-async/EpiCurl.php'); require_once(APPPATH.'modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php'); require_once(APPPATH.'modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php');
require_once(APPPATH.'modules /帐户/插件/库/ jmathai-Twitter的异步/ EpiCurl.php'); require_once(APPPATH.'modules /帐户/插件/库/ jmathai-Twitter的异步/ EpiOAuth.php'); require_once(APPPATH.'modules /帐户/插件/库/ jmathai-Twitter的异步/ EpiTwitter.php');
/* End of file twitter_pi.php / / Location: ./system/application/modules/account/plugins/twitter_pi.php */
/ *文件结束twitter_pi.php //位置:./ system /application / modules /account / plugin / twitter_pi.php * /
In controller
在控制器中
$this->load->plugin('twitter'); $twitterObj = new EpiTwitter($this->config->item('twitter_consumer_key'), $this->config->item('twitter_consumer_secret'));
$这 - >负载>插件( '叽叽喳喳'); $ twitterObj = new EpiTwitter($ this-> config-> item('twitter_consumer_key'),$ this-> config-> item('twitter_consumer_secret'));
There is one problem with this in Codeigniter 2.0 there are no plugins
Codeigniter 2.0中存在一个问题,即没有插件
2
Oh yes codeigniter is nice and has also support for many librarys please have a look here http://www.haughin.com/code/ Include the Amazon service like this $this->load->library('s3');
哦是的codeigniter很好,也支持许多图书馆请看看这里http://www.haughin.com/code/包括这样的$ this-> load-> library('s3');
0
@user3526 Note that $this->load->library('classname') will create an instance of that loaded class, not just file (class) include.
@ user3526注意$ this-> load-> library('classname')将创建该加载类的实例,而不仅仅是文件(class)include。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2010/02/25/b348193316d51d0e71e3ac90c24f1eb9.html。