How Do You Convert a Page-Based PHP Application to MVC?

后端 未结 11 961
野趣味
野趣味 2021-02-01 09:48

I\'ve been struggling for some time now with exactly how to recode a page-based PHP application using an MVC framework. Just for background, I am having to move the app into MVC

11条回答
  •  没有蜡笔的小新
    2021-02-01 10:18

    If I understand you correctly, each controller would produce one page. This can be a really bad idea that I've experienced first hand in a maintenance position.

    The "MVC" framework I dealt with that did the one controller to view quickly became a convoluted mess with lots of hacks and spaghetti code.

    Was this because of the framework, the developer, or both? How was it difficult to maintain? What hacks were involved and why?

    The 1 controller to 1 view works well for me in the php MVC frameworks Zend, CodeIgniter, and Kohana. In ASP.NET, although not MVC, 1 webform/view is mapped to 1 code behind file.

提交回复
热议问题