Home > Article > Backend Development > I am a beginner, how can I understand the concept of ThinkPHP5 model?
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? // . . .
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