I am trying to learn php MVC based webpage development.At first i literally thougt that it's just decoupling the project into 3 classes Model, View, Controller.But with help SO previous post comments, i realized that these are Not class but instead they are layers
(我正在尝试学习基于php MVC的网页开发。起初我只是想将项目分解为模型,视图,控制器3类,但是在之前的评论的帮助下,我意识到这些不是类,而是它们层数)
// don't be confused my class/OOP style, it is just for conceptual purpose
Model.php Layer related code
View.php Layer related code
Controller.php Layer related code
User: index.php
//initiating model layer related things
$m = new Model;
// initiating Controller layer related things
$v = new Controller($m);
// initiating view layer related things
$c = new View($m, $c);
However, there are many MVC example over internet which are confusing and conflicting sometime.For example some suggest: controller have the access of both model & view, where other suggest view have the access of both.So please anyone check my code sequence to ensure that it does follow the MVC pattern correctly.
(但是,Internet上有很多MVC示例,它们有时会造成混淆和冲突。例如,一些建议:控制器可以同时访问模型和视图,而其他建议视图可以同时访问两者,因此请任何人检查我的代码序列以确保它确实遵循MVC模式。)
ask by user5005768Himadree translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…