When should i use multiple controllers in mvc?

can i use multiple controllers in mvc?

eg.

/controllers/foo.php

/controllers/bar.php

or

/controllers/foo/baz1.php

/controllers/foo/baz2.php

/controllers/bar/baz1.php

/controllers/bar/baz2.php

can someone give some examples WHEN I might want to do this and some examples of controller names.

Once I thought, maybe when you have a main site (for users) and an admin site (for clients).

all reviews and suggestions rated

+3
source share
4 answers

, . , , User and Post , , . RoR-, PHP MVC. URL- :

/controller/action/parameter1/parameter2/...
i.e.
/users/edit/1/
or
/posts/new/

. , - MVC, .

+4

, . -, , -. , (, , , , ..). -, , search.whatever. .. RESTful RFC (, , RFC ), - something.com/noun/verb, == - "", , == (. ). .

+1
+1

, , Employee, Department, 3 , ? : UserController, EmployeeController, DepartmentController ..

:

//
//1/
//1/

//
//1/
//1/

//
//1/
//1/

+1

Source: https://habr.com/ru/post/1740856/


All Articles