No one saw the label separating the obligations between the model and the controller? Clarify what functions belong to the controller in pkhp. I read a couple of articles, I realized that he was engaged in processing the parameters GET, POST and depending on their values, separate methods are called. I want to divide the code correctly between the controller and the model. Thank you. What part of working with a database refers to it? Where is the data validation? Form processing?
Something like this: there is an index.php file in it, we look at the current URL and break it into its component parts with the help of explode, for example the URL was of this kind - http://site.ru/user/register/ - everything is simple, URL can be divided into user and register, where the user has the model name, then simply, when there is a model name, we can check its existence, and call it, also, if there is anything else, in this case register, in the case of OOP, this is the method ( function) and we will call it if there is no method, that is, like this: http://site.ru/user/ then in the model we should have an index () method that will be called if not other routers, also in htakces, we will need to redirect all requests to the index.php file
This is in the MVC design pattern like so) examples of MVC sea, google help
The controller (English controller - controller, controller), Model (fr. Modèle, from latin. Modulus - “measure, analog, sample”) is a simplified representation of the real device and / or processes occurring in it, phenomena.
those. we get all the logic and behavior described in the models and in the controller we manage these models