MVC结构的正确方法?

时间:2013-08-11 14:57:51

标签: php codeigniter

我是MVC新手并尝试使用codeignater将现有项目转换为MVC。以下是当前的项目结构及其内容。

我想知道,哪种方法转到哪个控制器。指导对我来说真的很有用。

index.php     //contains links to students.php, professors.php, student_prof.php, admin/index.php
students.php   //lists all students
professors.php   //lists all professors
stud_prof.php   //lists both students along with thier respective professors

admin //folder
  index.php   //login page
  students.php // add, edit, delete, list students
  professors.php // add, edit, delete, list professors
  logout.php   //logout for admin

我的尝试:

models
Students_model     //add, edit, delete, list methods
Professors_model //add, edit, delete, list methods
Admin //login method

controllers
Index // show_links method
Students //add, edit, delete, list students methods
Professors //add, edit, delete, list professors methods
Admin //login, logout methods

1 个答案:

答案 0 :(得分:1)

我想你是想知道应该如何命名和放置。

我会喜欢这个

的观点 -professor文件夹 ---的index.php --- xxxx.php

我认为控制器名称应该是小写而没有's / es'。它们可能影响SEO排名,因为它们作为URL细分公开显示。

小写也应该适用于模型。

enter image description here

我还创建了一个名为'asset / assets'的文件夹,并将Javascript和CSS放在相应的文件夹中。

enter image description here

祝你好运伴侣!

相关问题