开发者

Question about MVC folder structure

开发者 https://www.devze.com 2022-12-18 13:50 出处:网络
To use the MVC pattern/layout stru开发者_Go百科cture, does it basicly require everything to be loaded through 1 file, like your index file?No. The MVC pattern only dictates a separation of concerns re

To use the MVC pattern/layout stru开发者_Go百科cture, does it basicly require everything to be loaded through 1 file, like your index file?


No. The MVC pattern only dictates a separation of concerns regarding event/request handling, data modelling and user interface. The way this is implemented is not specified.

Many (all?) of the current PHP frameworks I am aware of do use a single entry point (index.php) and route from there. This often makes use of the "Front Controller" pattern.

The other method (using a separate PHP file per page) is known as the Page Controller pattern. It has the advantage of being much simpler, but loses the application wide control afforded by the front controller and may be prone to code duplication.


No. Nothing about the MVC pattern in and of itself says anything about how your files or folders should be arranged. A given framework that you use might mandate a particular arrangement, however.

0

精彩评论

暂无评论...
验证码 换一张
取 消