Can I call a Model from a View?

后端 未结 4 1834
再見小時候
再見小時候 2020-11-27 21:13

Rather than use a full-blown PHP MVC, I\'m designing one that will best-fit my uses. I have the basic framework done, and have coded the models and controllers I\'ll need to

4条回答
  •  旧巷少年郎
    2020-11-27 21:56

    Okay, I would really try to keep my Views as logic-free as possible. If you need to switch anything based on e.g. the result of a model method, put a controller in place that delegates the rendering.

    Just make sure you follow the basic idea: Do your stuff in the models, Tell your models what to do from your controllers and also tell your views what to show from your controllers.

提交回复
热议问题