主要内容: M---------->model 模型 V------------>view 视图 C---------->Action 控制
1.在Action里新建一个UserAction.class.php文件
<?php
class UserAction extends Action
{
public function index()
{
echo '这是UserAction下的index()方法';
}
public function del()
{
echo '这是UserAction下的del()方法';
}
}
?>
然后访问自己的目录:http://localhost/workspace/myapp/index.php/User/del (在linux下注意大小写问题),接着就会得到
这是UserAction下的del()方法
2模板问题
a.在tpl目录下新建一个文件夹User(注意大小写),然后在里面新建index.html和del.html,在index.html里写上'这是Tpl
下的index.html',在del.html里写'这是Tpl下的del.html'。
b. 在UserAction里的方法
<?php
class UserAction extends Action
{
public function index()
{
//echo '这是UserAction下的index()方法';
$this->display();
}
public function del()
{
// echo '这是UserAction下的del()方法';
$this->display();
}
}
?>
然后访问自己的目录:http://localhost/workspace/myapp/index.php/User/del总结:UserAction默认的是Tpl下User文件 ,然后index()方法对应index.html,del()对应del.html