How to call codeigniter controller function from view

后端 未结 14 1748
小蘑菇
小蘑菇 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:35

    Codeigniter is an MVC (Model - View - Controller) framework. It's really not a good idea to call a function from the view. The view should be used just for presentation, and all your logic should be happening before you get to the view in the controllers and models.

    A good start for clarifying the best practice is to follow this tutorial:

    https://codeigniter.com/user_guide/tutorial/index.html

    It's simple, but it really lays out an excellent how-to.

    I hope this helps!

提交回复
热议问题