Home  >  Article  >  PHP Framework  >  What are thinkphp's models, controllers, and views?

What are thinkphp's models, controllers, and views?

王林
王林Original
2019-09-11 17:50:493803browse

What are thinkphp's models, controllers, and views?

First of all, let’s introduce what a model, a view, and a controller are.

Model - responsible for storing the central data of the system;

View - display information to the user;

Controller (controller) - handles user input information, is responsible for reading data from the view, controlling user input, and sending data to the model. It is the part of the application that handles user interaction. Responsible for managing interaction control with users;

Views and controllers together constitute the user interface.

And each view has a related controller component. The controller accepts input, typically as time encoded for mouse movement, mouse button activity, or keyboard input. Times are translated into server requests for models or views. The user interacts with the system only through the controller.

What are thinkphps models, controllers, and views?

Structure:

The model component contains the functional core of the application, which encapsulates the corresponding data and outputs execution The process of processing by a specific application; the model also provides functions to access data that is used by the view component to obtain the data to be displayed. The controller calls all these procedures on behalf of the user.

Purpose:

Realize a dynamic programming that simplifies the modification and expansion of the program later, and makes it possible to reuse a certain part of the program . By simplifying the complexity, the program structure is made more intuitive.

Separate the internal representation of information from how it is presented and accept user requests. It separates components and allows efficient code reuse. That is, the implementation code of the model and view is separated, so that the same program can use different representations. For example, you can represent a batch of statistical data in bar charts and pie charts respectively. The purpose of C is to ensure the synchronization of the model and the view. Once the model changes, the view should be updated synchronously.

The above content is for reference only!

Recommended tutorial:

ThinkPHP tutorial

The above is the detailed content of What are thinkphp's models, controllers, and views?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn