How to call codeigniter controller function from view

后端 未结 14 1745
小蘑菇
小蘑菇 2020-11-27 05:53

How to call codeigniter controller function from view? When i call the function in a controller, get a 404 page.

14条回答
  •  北海茫月
    2020-11-27 06:58

    I know this is bad.. But I have been in hard situation where it is impossible to put this back to controller or model.

    My solution is to call a function on model. It can be do inside a view. But you have to make sure the model has been loaded to your controller first.

    Say your model main_model, you can call function on the model like this on your view : $this->main_model->your_function();

    Hope this help. :)

提交回复
热议问题