MVC的目录结构 [英] Directory Structure for MVC

查看:158
本文介绍了MVC的目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想收拾我一直在工作的框架。眼下,该网站由以下目录:

I'm trying to clean up the framework I've been working on. Right now, the site consists of the following directories:

Models
Views
Controllers
Helpers (Miscellaneous functions)
Libraries (Universal classes, like library and session management)
Images
Style

任何时候一个页被调用时,路由器脚本查找相关联的控制器,所以thesite.com/login将在'/controllers/login.php'我面对,则该路由器脚本本身的感觉的问题实例Login_Controller就像一个类型的控制器一样,view.php,处理由相应的视图处理格式数据。但这些都不是很喜欢的页面控制器,因为他们控制MVC本身。我还是有点新的这种架构中,我很好奇如何更有经验的人将组织这一点。

Any time a page is called, the router script looks up the associated controller, so thesite.com/login would instantiate Login_Controller at '/controllers/login.php' The problem I'm facing is, the router script itself feels like a type of controller, as does view.php, which handles formatting data to be handled by the appropriate view. But these aren't quite like page controllers, since they control the MVC itself. I'm still somewhat new to this architecture, and I'm curious how someone with more experience would organize this.

我能分类的路由器和视图控制器为库,或者它会更好地里面创建一个子目录/控制器称为页,或任何其他的想法?非常感谢。

Could I classify the router and view controllers as libraries, or would it be better to create a subdirectory inside /controllers called 'pages', or any other ideas? Thanks so much.

推荐答案

我会建议遵循<一个href=\"http://www.symfony-project.org/book/1_0/02-Exploring-Symfony-s-$c$c#chapter_02_sub_file_tree_structure\">Symfony 1.x的目录结构 。清晰,合理,安全的。

I would suggest to follow the Symfony 1.x directory structure. Clear, logical, secure.

这篇关于MVC的目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆