MVVM模式应该怎么在PHP中应用

WBOY
Release: 2016-06-13 13:22:21
Original
1360 people have browsed it

MVVM模式应该如何在PHP中应用?
MVVM模式是如何在PHP中应用?
(1)MVVM模式能否在PHP中使用;
(2)能不能简单说下实现方法。
给出思路就行不必具体代码

------解决方案--------------------
什么是MVVM呢,就是Model,View,ViewModel。

Model就是对数据的抽象,数据的封装。比如,Person。 
View就是UI表现层,提供与终端用户的交互。比如,一个用户录用界面。 
ViewModel是这种模式的核心,提供了一个Model与View之间的桥梁。它应该提供了View中所有用户可能的操作对应的处理,以及该处理能去Model进行必要的操作,或者缓存该处理结果,等待下次使用


据此而言 Smarty 就是 ViewModel 最好的体现了。尽管 Smarty 要早于 ViewModel 十年以上
------解决方案--------------------
php里应该说pardo接近这种模式
------解决方案--------------------
我觉得就用类+HTML+SMARTY组合。不就类似楼主你说的这个了吗。至于名词定义,我觉得MVC也好,MVVM也好,那都是一个规范,越大的规范对于进大公司有好处。用的人多,上手快。规范小了。也许只局限于你们公司,出去了其他人就不用这些了。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!