在CodeIgniter中加载自定义类? [英] Loading custom classes in CodeIgniter?

查看:82
本文介绍了在CodeIgniter中加载自定义类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始使用CodeIgniter,我想导入一些旧类以用于新项目。但是,我不想对它们进行太多修改以适应CI的做法,我希望能够继续使用NetBeans的自动完成功能,这对于CI不起作用。 / p>

那么,什么是加载自定义类和类文件转换为CodeIgniter而不必使用库/模型加载机制?



我道歉,如果这是我应该能够迅速找到,找到我在后。我看到的只是告诉我如何通过CI。

解决方案

我会说你至少写一个包装类可以 require 类和实例化对象并使其可访问。然后你可以自动加载这样的库,并根据需要使用它。



我建议你至少尝试让他们适合CI的方式,让你的生活更容易。我一直在同样的位置,一路上学到了这一点。


Just starting to use CodeIgniter, and I'd like to import some of my old classes for use in a new project. However, I don't want to modify them too much to fit into the CI way of doing things, and I'd like to be able to continue to use NetBeans' autocomplete functionality, which doesn't work too well with CI.

So, what is the best way to load custom classes & class files into CodeIgniter without having to use the library/model loading mechanisms?

I apologise if this is something I should be able to find quickly, but I can't seem to find what I'm after. Everything I see is just telling me how to go through CI.

解决方案

I'd say you at least write a wrapper class that could require the classes and instantiate the objects and make them accessible. Then you could probably autoload such library and use it as needed.

I would recommend that you at least tried to have them fit in the CI way, as moving forward this will make you life much more easy. I've been in kind of the same position and learned just this along the way.

这篇关于在CodeIgniter中加载自定义类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆