且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Codeigniter中扩展多个模型2

更新时间:2023-11-19 17:09:16

,你只是把两个类放在同一个MY_Model文件中。此文件用作codeigniter的自动加载功能的一部分,这意味着它将查找具有MY_(或config defined)前缀的任何文件。

As I said in this question about the controllers you just put both classes in the same MY_Model file. This file is used as part of the autoload feature of codeigniter, meaning that it will look for any files with the MY_ (or config defined) prefix.

甚至需要调用MY_Model里面的类,你可以调用它MY_Special_Model,并在下面有MY_Another_Model

You don't even need to call the class inside MY_Model you can potentially call it MY_Special_Model and have MY_Another_Model directly underneath