开发者

Recommended approach to combining raw PHP and Codeigniter

开发者 https://www.devze.com 2023-01-30 16:18 出处:网络
I\'m building a web app using Codeigniter as my framework of choice.I have a 开发者_开发百科3rd party library that I am using to handle some OpenID authentication.The library is written in raw PHP (I\

I'm building a web app using Codeigniter as my framework of choice. I have a 开发者_开发百科3rd party library that I am using to handle some OpenID authentication. The library is written in raw PHP (I've tried some of the OpenID libraries written for Codeigniter but I couldn't get any of them to really work how I wanted to).

What is the recommended approach for using this raw PHP library alongside my Codeigniter files? The library isn't all that big but I'd much prefer if there is a way I can just plug this library into my Codeigniter app because I am new to Codeigniter and I'd rather spend my time building my application then porting a library from raw PHP to Codeigniter if I don't have to.

Additional info: I have written several applications in raw PHP, but I am new to Codeigniter


Is the library a class in a single file? The "Codeigniter Way" to handle this is to put it into your application/libraries directory. In CI call $this->load->library('MyLibraryName'); before you use it. (There are also ways to load your library automatically - see application/config/autoload.php)


include 'wherever/it/is.php';

$foo = new Bar;

Magic! :)

0

精彩评论

暂无评论...
验证码 换一张
取 消