**CI中自动类加载的用法总结

总结:

哪一个类中用到某一个类,就在构造函数中加载这个类,比如m_attach,C_Feed类中有用到,那么就在构造函数中加载

控制器:

class C_Feed extends CI_Controller {

public function __construct()
{
parent::__construct();
//加载模型类
$this->load->model('m_feed');
$this->load->model('m_attach');


}

模型类:

class M_Feed extends CI_Model {

public function __construct()
{
//加载数据库配置
$this->load->database();
$this->load->model('m_attach');

}

你可能感兴趣的:(类加载)