Answer the question
In order to leave comments, you need to log in
How to properly use Controllers in yii2?
Hello everyone, sorry for such a childish question :)
Well, I think it's better to ask than to make a shed ...
my structure
controllers\sitedefault
controllers\comments\CommentsController
controllers\photo\PhotoController
models\comments\commentsUser
models\comments\commentsVk
controllers\photo\PhotoUser
controllers\photo\PhotoVk
Answer the question
In order to leave comments, you need to log in
Yes, that's right, you can have your controllers with such a structure. This option is described in the standard documentation and there are examples of accessing controllers. www.yiiframework.com/doc-2.0/guide-structure-contr...
I think it's more a matter of taste as you like, someone prefers to make modules, someone scatters it in directories, and someone just pours everything into controllers .
Is that even possible? In my opinion, all controllers should be in the same folder, in your case it would be better to divide the site into modules.
I have seen such a structure. The question is thinking about religion although I may be wrong.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question