控制器(controller)的作用通常是在获取模型(model)中数据并交给视图(view)去显示,那开发中我们应该如何去写呢?

1.创建Controller的类文件,我这里文件名为MatchController.class.php(推荐学习:PHP编程从入门到精通)
getList();
// $m_match2 = Factory::M('MatchModel');
// 载入负责显示的html文件
require './template/match_list_v.html';
}
/**
* 比赛删除
*/
public function removeAction(){
}2.在入口文件中实例化控制器对象(前端控制器或请求分发器),文件名index.php
为了能让index.php去执行我们要操作的动作,应该传给index.php一些参数,来告诉入口文件怎么做。
立即学习“PHP免费学习笔记(深入)”;
假如我们要在比赛列表(比赛Controller)中删除一条比赛信息,可以这样传参给index.php:
index.php?c=match&a=remove&id=N
相应的HTML文件应该这样写:

index.php:
$action_name();//可变方法











