用模型和不用模型的区别php,php – MVC:应该直接看模型吗?

早些时候,许多开发者认为视图不应该直接与模型通信,就像大多数框架一样.

然后,这个意见似乎是错误的,我找到一些文章,这些文章说这个观点可以直接与模型交流.

这些文章中的大多数引用了维基百科,模型视图控制器的一个块,引号是:

A view queries the model in order to generate an appropriate user interface (for example the view lists the shopping cart’s contents). The view gets its own data from the model. In some implementations, the controller may issue a general instruction to the view to render itself. In others, the view is automatically notified by the model of changes in state (Observer) that require a screen update.

啊,这是从维基百科,这样一个权威的网站,一定是对的!

视图的新定义是:

A view requests from the model through the controller the information that it needs to generate an output representation to the user.

现在我再次感到困惑,新的定义表示视图应该通过控制器从模型中请求数据…

视图访问模式是否直接在地球上?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值