从另一个控制器codeigniter调用模型的方法(Calling a method of a model from another controller codeigniter)
我有两个控制器hrcontroller和admincontroller 。
并模拟hrmodel和adminmodel 。
可以从admincontroller访问hrmodel的方法。 ?
I am having two controllers hrcontroller and admincontroller.
And models hrmodel and adminmodel.
It is possible to access a method in hrmodel from admincontroller. ?
最满意答案
在你的admincontroller你就是这么做的
$this->load->model('hrmodel'); $this->hrmodel->get_data(); //replace get_data for a real function on your model你可以加载你想要的所有模型。
in your admincontroller you just do this
$this->load->model('hrmodel'); $this->hrmodel->get_data(); //replace get_data for a real function on your modelyou can load all models you want doing this.
更多推荐
发布评论