去饭店(商场)吃饭的步骤:
- 告诉前台服务员,来一小碗牛肉拉面,菜单上勾上一个牛肉拉面(url)
- 服务员去拉面窗口,告诉后厨,一碗牛肉拉面),后厨(view)开始准备。
- 后厨给打杂小弟说,给我一份儿面条和牛肉。打杂小弟(model)说好的
- 打杂小弟去冰箱(数据库)找到面条和牛肉。送给后厨
- 后厨收到面条和牛肉,做了一碗牛肉拉面,送到拉面出餐口(API),按铃
- 服务员(templete),配上酱油醋,筷子,端给顾客。
在这里,我们梳理一下对应关系:
菜单————url——索引或者控制器
后厨————view————根据菜单加工
打杂小弟———model————根据后厨说的需求去找东西
冰箱————数据库————食材存放处
端菜服务员——templete————展示,最终给客户的牛肉拉面