Home >Backend Development >PHP Tutorial >I am a beginner, how can I understand the concept of ThinkPHP5 model?

I am a beginner, how can I understand the concept of ThinkPHP5 model?

WBOY
WBOYOriginal
2016-08-04 09:22:161082browse

I am a beginner who has just come into contact with PHP and ThinkPHP5.
I saw the model in the document today,
but I don’t quite understand the concept of model.
Please help me introduce the ThinkPHP framework:
What is a model? Can the model work? // . . .

Reply content:

I am a beginner who has just come into contact with PHP and ThinkPHP5.
I saw the model in the document today,
but I don’t quite understand the concept of model.
Please help me introduce the ThinkPHP framework:
What is a model? Can the model work? // . . .

MVC (Model View Controller) Model-View-Controller

View is the interface that users see and interact with. Views are generally pages composed of HTML elements. View folder in ThinkPHP.

The model is a container for operating database data and executing business rules. The data format returned by the model is fixed. It provides data for multiple views and is reused by multiple views, reducing code duplication. Model folder in ThinkPHP.

The controller accepts user input and then calls the model and renders the view to complete the user's needs. Generally speaking, the controller only receives the request and decides which model method to call to process the request and then selects which view to render the data. Controller folder in ThinkPHP.

The above are some of my understandings. Comments are welcome. Like it if you find it helpful~

You should be familiar with programming development design patterns

ThinkPHP really makes me unbearable. After developing a few versions of php, I will fucking abandon the old version and develop a new version! The old version is not maintained at all!
Now I have completely switched to laravel!

Model refers to the data model, which encapsulates (layers or abstracts) the operations of resources (data tables) through ORM object relational mapping, with the purpose of achieving a clear project structure and improving code reuse rate

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
Previous article:phpstorm download addressNext article:phpstorm download address