Now learning the thinkphp framework. There is a question. I used to think that the data query was written in the model. Try to write and read a few items. The discovery write is written in the controller. But here's the problem. Does the model not write business logic and data processing? Why does my model file just write an inherited parent class, others do not have to write it?
Reply content:
Now learning the thinkphp framework. There is a question. I used to think that the data query was written in the model. Try to write and read a few items. The discovery write is written in the controller. But here's the problem. Does the model not write business logic and data processing? Why does my model file just write an inherited parent class, others do not have to write it?
Model is not write business logic, but put code to interact with the database at the model level I think it's okay.
If the program is large, the business logic should be a separate layer
Data queries can be used as service tiers
First 1th, the DB operation is definitely placed in the model of the clatter, 2nd, suggesting learning other frameworks.