require_once '../phpbean/Nation.class.php'; require_once '../service/NationService.class.php'; //创建了NationService实例 $nationService = new NationService(); //根据action参数决定用户要执行什么样的操作 if (!empty($_REQUEST['action'])) { //接收action值 $action = $_REQUEST['action']; if ($action == "add") { //说明用户希望执行添加民族信息信息 $nation = new Nation(); $array_nation = $_POST["nation"]; $nation->setNationId($array_nation['nationId']); $nation->setNationName($array_nation['nationName']); //完成添加->数据库 $res = $nationService->AddNation($nation); if ($res == 1) { header("Location: /ok.php"); exit; } else { //失败 header("Location: /error.php"); exit; } } else { if ($action == "query") { //查询民族信息信息 require_once '../service/NationService.class.php'; require_once '../service/FenyePage.class.php'; //获取查询参数 //创建NationService实例