The pizza boy's brain is the controller. As soon as you say the word
“Margarita” in a language that he understand, the work begins.
This work is similar in nature to making a Calzone or Neapolitan
pizza, but uses distinct ingredients that will never be confused.
The pizza boy can only use the tools and resources that are behind the
bar. This limited tool set is the model, and includes the following:
Finally, the finished pizza that you can see and consume is the view.
The view is built out of the limited options from the model, and
arranged and transmitted via the controller (that is, the pizza boy’s
brain).
# 1 楼答案
为了理解模型,或者总体上理解整个MVC模式,我想给大家举一个多米诺比萨饼店的例子
你走进一家奢华购物中心的美食广场,走近多米诺骨牌柜台。由于柜台已经很拥挤,你等待轮到你的时候,一旦轮到你或者你现在是第一个排队的人,你就会脱口而出:“请给我一杯玛格丽塔酒,配肉丸子和额外的奶酪!”
您是用户,您的披萨订单是用户请求。对你来说,玛格丽塔只是你最喜欢的披萨,而且你很清楚这将是一个有很多奶酪和肉丸的蓬松披萨
披萨男孩很快向你点头。对于披萨男孩来说,玛格丽塔并不是一种特殊的披萨,它只是一系列步骤:
也许将来,他们可能会有一个机器人助手!或者自动披萨机。这对你的披萨男孩来说并不重要,他只能使用可用的资源
# 2 楼答案
从端点触发的处理结果是包含视图将呈现的所有相关信息的某个对象。这个对象基本上是MVC框架中的一个模型
在渲染过程中,模板中的数据将从模型的字段中显示
该模型提供了业务流所有结果的封装视图