I wanted to understand the MVC model properly, so I wrote an article.
Since you are a beginner, please point out if there is a misunderstanding.
The idea of dividing the responsibility of the program into three MVCs in this way is called the MVC model.
First, the user requests some URL. Then, in the framework, a router accepts URL requests. The router is the part that performs the assignment process that assigns the received URL to the action of which controller. The router then calls the action. The controller receives this request and queries the database for item / 1 item information. When querying the database, the controller queries the model.
The model interacts with the database and returns the results to the controller. In this way, the model is the part that interacts with the database. The controller that then receives the data from the model then transfers the data to the view. The view then uses this information to generate an Html for dynamic return. The generated controller is returned to User as a response.
In this way, the MVC model has three roles: Controller, Model, and View. There is also what is called a router for calling the controller.
Recommended Posts