MVC | Sololearn: Learn to code for FREE!



Recently I was told that php mvc differs from others. Is it true? I cant determine.

12/11/2017 8:23:20 AM


1 Answer

New Answer


The MVC principle is to separate the application into 3 main parts, known as the Model, the View, and the Controller. Apparent from the diagram are the direct associations (solid lines) and the inferred associations (dashed lines). The inferred associations are associations that might seem apparent from the point of view of the user, and not from the actual software design. A simple way to think of this would be to consider the following: A user interacts with the view - by clicking on a link or submitting a form.The Controller handles the user input, and transfers the information to the modelThe Model receives the information and updates it's state (adds data to a database, for example, or calculates todays date)The View checks the state of the Model and responds accordingly (listing the newly entered data, maybe)The View waits for another interaction from the user. But what does this mean to you and why should you consider using it? Well, for starters, MVC has a really good philosophy. The idea that you are separating the logic from the display is not new, but MVC presents the idea nicely. Code presentation and layout are simpler, making your application more maintainable. The view is in the view files, the logic in the template, and the controller handles them all.