搭建MVC框架,实现在地址栏传递参数index.php?c=news&a=add后,输出"这里是新闻添加"

来源:互联网 发布:印尼海关数据免费查询 编辑:程序博客网 时间:2024/05/21 13:04
index.php文件

<?php
header("Content-Type:text/html;charset=utf-8");
if($_REQUEST['c'] == 'news'){
require "controllers/admin/goodsController.class.php";
$controller = new goodsController();
if($_REQUEST['a']=='add'){
$controller ->addAction();
}

}

goodsController.class.php文件

<?php

class goodsController{
//控制器的作用是:
function addAction(){
echo '这里是新闻添加';
}
function delAction(){

}
function correctAction(){

}
function searchAction(){

}


}

原创粉丝点击