Php mvc many view need to be divided into different heads and bottoms, how to achieve it?

php mvc many view need to be separated from the head and the bottom, these heads and the bottom may be the same, may not be the same, how to achieve?

I"m writing my own framework, and I see that other mature frameworks are too complex. So, big brothers, do me a favor

1. Now, I think, it is the include? in the current view page. Or automatically load the new class and divide it into two function?. Or something else?

2, third-party sdk, such as: Alipay app pay, Wechat"s, so how to integrate? Is it still use new? is class coming in?

Xiaobai asks for advice.

Php
Apr.29,2021

solution

you can generally see that include came in, or spliced rendering. When you say new one or another to function, that violates MVC.

third-party SDK

most third parties provide online documentation and interface descriptions. You can read the documentation and integrate it yourself, or you can go to packagist to help you manage through Composer.

take Alipay as an example, the SDK provided by Alipay does not automatically load according to the specification of PSR4, so you need to import the file manually and implement it according to the official document.
in most cases, however, we don't need such a complete SDK, so we can encapsulate it according to our own business needs.

Design pattern

the design pattern mentioned above keeps in mind that MVC is not a design pattern.

then you'd better not write a frame. You don't even know the design pattern, and the framework you write is useless


No one comes to
people

.
Menu