Loading custom classes in CodeIgniter?

前端 未结 4 1553
醉话见心
醉话见心 2021-01-02 00:49

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

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 01:23

    To do it codeigniter way, place your custom classes in libraries folder of codeigniter. And then use it by adding that class as library in your controller like this:

    using in controller:

    $this->load->library('someclass');
    

    checkout complete article at http://www.codeigniter.com/user_guide/general/creating_libraries.html

提交回复
热议问题