Home >Backend Development >PHP Tutorial >The master of TP framework answers my doubts

The master of TP framework answers my doubts

WBOY
WBOYOriginal
2016-07-06 13:54:001152browse

tp is a framework of MVC pattern, but why do I rarely use M when developing projects or watching many tp teaching videos? I myself have been writing code in V and C. When should I write in M? Thanks for the answer

Reply content:

tp is a framework of MVC pattern, but why do I rarely use M when developing projects or watching many tp teaching videos? I myself have been writing code in V and C. When should I write in M? Thanks for the answer

In the conventional MVC framework, the M layer should be responsible for most of the data operations. If the business logic is used, the EVENT layer under TP should be better used. At this time, the business logic will be placed in the event layer, and then the model The layer is responsible for more atomic data operations, improving code reuse and development efficiency

Because those tutorials put all curd in the C layer, only used the automatic verification, automatic completion and other functions of the M layer, and did not extract the data operations to the Model

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