drbmhd9583 2016-02-09 11:30
浏览 68
已采纳

从另一个控制器codeigniter调用模型的方法

I am having two controllers hrcontroller and admincontroller.

And models hrmodel and adminmodel.

It is possible to access a method in hrmodel from admincontroller. ?

  • 写回答

2条回答 默认 最新

  • doucan1979 2016-02-09 11:52
    关注

    in your admincontroller you just do this

    $this->load->model('hrmodel'); 
    $this->hrmodel->get_data(); 
    //replace get_data for a real function on your model
    

    you can load all models you want doing this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?