In PHP, how do you give the interviewer a perfect explanation of the difference between a model and a controller?

during the interview, the interviewer asked me what is the difference between a model and a controller.

I replied: the main purpose of the controller is to provide the model with what needs to be done, and the model is equivalent to all the ordered things.

the interviewer said that the explanation is not in place, bosses, how to explain in place? And what is written in many books is not clear, the kind that passes by.

Php
Jan.08,2022
The

controller is responsible for directing the data to the corresponding Model and view, while the Model is responsible for the data or logic operated by the program


the answer to this question must be different for each interviewer. Although the MVC model has existed for a long time, the understanding of MVC belongs to thousands of people. I would like to share with you my understanding of MVC.

in the traditional MVC I understand, the controller is responsible for receiving, verifying, data entered by Filter users, permissions, etc., and calls the logical methods in the corresponding model to complete the business, get the returned data, execute Filter and format, and finally give it to the view to render. The model is responsible for the processing of the specific business logic of the complete project and the work of data persistence.

the difference between the controller and the model is that the controller is concerned with input and output and permissions (boundaries), while the model is concerned with specific business and data (business)

.

at the MVC level. Except that it's all PHP code, everything else is different.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b43907-40c2c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b43907-40c2c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?