Home  >  Article  >  Backend Development  >  contoller 向 view 传递数据,是否需要封装,如何封装

contoller 向 view 传递数据,是否需要封装,如何封装

WBOY
WBOYOriginal
2016-06-06 20:35:11921browse

使用 php 的 mvc 架构开发,目前是在 contoller 中将数据打包进一个数组然后传递给 view , 但感觉这样纯粹靠‘口头约束’有点不靠谱啊。不知道各位是怎么操作的?

回复内容:

使用 php 的 mvc 架构开发,目前是在 contoller 中将数据打包进一个数组然后传递给 view , 但感觉这样纯粹靠‘口头约束’有点不靠谱啊。不知道各位是怎么操作的?

不管怎么分,最终的实现还是混编。

phpcms的更操蛋 直接数组extract

我现在的处理方式是将传入 view 的数据 细化拆分到不同的接口,在 view 调用对应方法获得数据。 这样‘口头约束’问题是解决了,但感觉耦合更严重了,如果发生变更也是够要命的。 不知道还有没有什么好的方案

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