我的LabPHP框架的Demo应用——课程设计题目统计系统

1、界面制作(为了方便起见,这里我采用了Bootstrap框架制作界面);

2、数据库设计,正确创建students表;

admin表:

3、项目目录结构如下:

LaPHP框架已经在上文中列出,这里就不再列出。

Home模块(提供“新增题目”和“修改试题”、查看所有学生题目的功能):

Application/Home/Config/config.php

<?php
	return array(
		//'配置项'=>'配置值'
		'DB_HOST' => 'localhost', //设置主机
		'DB_USER' => 'root', //设置用户名
		'DB_PWD' => '', //设置密码
		'DB_PORT' => '3306', //设置端口号
		'DB_NAME' => 'mydb_329', //设置数据库名

		/* 模板设置 */
	    'TMPL_TEMPLATE_SUFFIX'  =>  '.php',     // 默认模板文件后缀
	);
?>

Application/Home/Controller/IndexController.class.php

<?php
	class IndexController extends Controller {
		function index() {
			//echo "<p style='width: 50%; height: 300px; line-height: 300px; padding: 10px 20px; font-family:\"微软雅黑\", \"Microsoft YaHei\"; font-size: 30px; margin: 50px auto; box-shadow: 0 0 3px #ABCDEF; text-align: center; position: relative;'>Hello LabPHP!<span style='line-height: 30px; font-size: 20px; position: absolute; bottom: 20px; right: 20px;'>欢迎使用LapPHP V1.0.0   By DreamBoy<span></p>";

			$students = M('Students'); //检查是否有错误提示
			if($res = $students->check()) {
				$this->assign('err', $res);
			}
			$this->display();
		}

		function doAction() {
			$students = M('Students');
			if($res = $students->checkForm()) { //验证表单字段
				$this->assign('err', $res)->display('Index/index');
			} else {
				if($this->validate($_POST['action'])) { //根据action执行相应操作
					if($_POST['action'] == 'add') {

						if($students->add()) {
							$this->assign('info', 'add')->show();
						} else {
							$this->redirect('Index/index', 'err=add');
						}

					} else if($_POST['action'] == 'modify') {
						if($students->modify()) {
							$this->assign('info', 'modify')->show();
						} else {
							$this->redirect('Index/index', 'err=modify');
						}
					}
				}
			}
		}

		//显示所有信息
		function show() {
			$students = M('Students');
			$cur = 1; //当前页数第一页
			if($this->validate($_GET['cur'])) {
				$cur = $_GET['cur'];
			}
			$res = $students->page($cur);
			$this->assign('res', $res)->assign('start', ($cur-1) * $students->getEachPageLen() + 1)->assign('prePage', $cur-1)->assign('nextPage', $cur+1)->display('Index/showStudent');
		}
	}
?>

Application/Home/Model/StudentsModel.class.php

<?php
	class StudentsModel extends Model {
		private static $err = array('sno'=>'学生学号不能为空!', 'name'=>'学生姓名不能为空!', 'psw'=>'修改密码不能为空', 'title'=>'题目标题不能为空!', 'add'=>'新增题目失败,原因可能为已新增过题目了,请尝试选择“修改试题”进行提交!', 'modify'=>'修改试题失败,原因可能为:1.未新增过题目;2.学生学号输入错误;3.修改密码输入错误!');
		private $eachPageLen = 15;

		/**
		 * 检查是否有错误提示
		 * @return [type] [description]
		 */
		function check() {
			if($this->validate($_GET['err'])) {
				return self::$err[$_GET['err']];
			}
			return '';
		}

		/**
		 * 检查新增题目或修改试题的提交过来的表单字段
		 * @return [type] [description]
		 */
		function checkForm() {
			$required = array('sno'=>'学生学号不能为空!', 'name'=>'学生姓名不能为空!', 'psw'=>'修改密码不能为空', 'title'=>'题目标题不能为空!');

			foreach ($required as $key => $value) {
				if(!$this->validate($_POST[$key])) {
					return $value;
				}
			}
			return '';
		}

		//新增数据
		function add() {
			$sno = $_POST['sno'];
			$name = $_POST['name'];
			$psw = $_POST['psw'];
			$title = $_POST['title'];
			$partner = $_POST['partner'];

			$sql = "INSERT INTO students(`sno`, `name`, `psw`, `title`, `last_time`, `partner`) VALUES('$sno', '$name', '$psw', '$title', now(), '$partner')";

			$res = $this->execute_dml($sql);
			if($res == 1) {
				return 1; //新增题目成功
			} else {
				return 0; //新增题目失败
			}
		}

		//修改数据
		function modify() {
			$sno = $_POST['sno'];
			$psw = $_POST['psw'];
			$title = $_POST['title'];
			$partner = !isset($_POST['partner']) || empty($_POST['partner']) ? '' : $_POST['partner'];

			$sql = "UPDATE students SET `title` = '$title', `partner` = '$partner' WHERE `sno` = '$sno' AND `psw` = '$psw'";

			$res = $this->execute_dml($sql);
			if($res == 1) {
				return 1; //修改题目成功
			} else {
				return 0; //修改题目失败
			}
		}

		//分页查询数据
		function page($cur) {
			$length = $this->eachPageLen;
			$offset = ($cur - 1) * $length;
			$sql = "SELECT * FROM students ORDER BY sno LIMIT $offset,$length";
			return $arr = $this->execute_dql_arr($sql);
		}
		//得到每页的页数
		function getEachPageLen() {
			return $this->eachPageLen;
		}
	}
?>

Application/Home/View/Index/index.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计系统</title>

    <!-- Bootstrap -->
    <link href="Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="Public/style.css" rel="stylesheet" type="text/css"/>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <div class="container">
      <div class="col-sm-3"></div>
      <div class="col-sm-6 content">
        <h2>课程设计题目统计系统</h2>
        <form class="form-horizontal" action="index.php?a=doAction" method="POST">
          <div class="form-group">
            <label for="number" class="col-sm-3 control-label">学生学号:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="number" placeholder="输入12位学号" name="sno">
            </div>
          </div>
          <div class="form-group">
            <label for="name" class="col-sm-3 control-label">学生姓名:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="name" placeholder="姓名" name="name">
            </div>
          </div>
          <div class="form-group">
            <label for="password" class="col-sm-3 control-label">修改密码:</label>
            <div class="col-sm-9">
              <input type="password" class="form-control" id="password" placeholder="首次输入作为后面修改的密码" name="psw">
            </div>
          </div>
          <div class="form-group">
            <label for="title" class="col-sm-3 control-label">你的题目:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="title" placeholder="按照课程设计题目要求" name="title">
            </div>
          </div>
          <div class="form-group">
            <label for="name" class="col-sm-3 control-label">合作学生:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="name" placeholder="姓名,没有就空,只负责不同方面" name="partner">
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
                <label>
                  <input type="radio" name="action" value="add"  checked="checked"> 新增题目
                </label>
                  
                <label>
                  <input type="radio" name="action" value="modify"> 修改试题
                </label>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
              <button type="submit" class="btn btn-info">提交操作</button>   
              <a href="index.php?a=show">显示全部学生题目</a>
            </div>
          </div>
          <?php
            if($err) {
          ?>
               <p class="info"><span style="font-weight: bold">错误:</span><?php echo $err;?></p>
          <?php
            }
          ?>
        </form>
      </div>
      <div class="col-sm-3"></div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="Public/js/bootstrap.min.js"></script>
  </body>
</html>

Application/Home/View/Index/showStudent.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计系统</title>

    <!-- Bootstrap -->
    <link href="Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="Public/style.css" rel="stylesheet" type="text/css"/>
    <style>
      p.info {
        margin-bottom: 0;
      }
    </style>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
	<div class="container">
      <div class="content">
        <?php
          if($info) {
            if($info == 'add') {
              $fo = '新增';
            } else if($info == 'modify') {
              $fo = '修改';
            }
        ?>
             <p class="info"><marquee behavior="scroll" direction="left"><span style="font-weight: bold">消息:</span><?php echo $fo . '题目成功!';?></marquee></p>
        <?php
          }
        ?>

        <table class="table table-hover">
          <caption><h3>学生课程设计题目</h3></caption>
          <?php
            if(!isset($res) || empty($res)) {
              echo '<tr><td>暂无学生题目</td></tr>';
            } else {
          ?>
          <thead>
            <tr>
              <!-- <th>删除</th> -->
              <th>序号</th>
              <th>学号</th>
              <th>姓名</th>
              <th>题目</th>
              <th>状态</th>
              <th>录入时间</th>
              <th>合作学生</th>
            </tr>
          </thead>
          <tbody>
            <?php
              $i = $start ? $start : 1;
              foreach ($res as $value) {
                echo '<tr>';
                echo "<th scope='row'>$i</th>";
                echo "<td>{$value['sno']}</td>";
                echo "<td>{$value['name']}</td>";
                echo "<td>{$value['title']}</td>";
                echo "<td>{$value['state']}</td>";
                echo "<td>{$value['last_time']}</td>";
                echo "<td>{$value['partner']}</td>";
                echo '</tr>';
                $i++;
              }
            ?>
          </tbody>
          <?php
            }
          ?>
        </table>
        <nav>
          <ul class="pager">
            <li>
              <?php
                if($prePage) {
                  if($prePage >= 1) {
                    echo "<a href='index.php?a=show&cur=$prePage'>上一页</a>";
                  }
                }
              ?>
            </li>
            <li>
              <?php
                if($nextPage) {
                  if($nextPage >= 1) {
                    echo "<a href='index.php?a=show&cur=$nextPage'>下一页</a>";
                  }
                }
              ?>
            </li>
          </ul>
        </nav>
        <a href="index.php">返回输入界面</a>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="Public/js/bootstrap.min.js"></script>
  </body>
</html>

Admin模块(提供管理员登陆和删除功能):

Application/Admin/Config/config.php

<?php
	return array(
		//'配置项'=>'配置值'
		'DB_HOST' => 'localhost', //设置主机
		'DB_USER' => 'root', //设置用户名
		'DB_PWD' => '', //设置密码
		'DB_PORT' => '3306', //设置端口号
		'DB_NAME' => 'mydb_329', //设置数据库名

		/* 模板设置 */
	    'TMPL_TEMPLATE_SUFFIX'  =>  '.php',     // 默认模板文件后缀
	);
?>

Application/Admin/Controller/IndexController.class.php

<?php
	class IndexController extends Controller {
		function index() {
			//echo "<p style='width: 50%; height: 300px; line-height: 300px; padding: 10px 20px; font-family:\"微软雅黑\", \"Microsoft YaHei\"; font-size: 30px; margin: 50px auto; box-shadow: 0 0 3px #ABCDEF; text-align: center; position: relative;'>Hello LabPHP!<span style='line-height: 30px; font-size: 20px; position: absolute; bottom: 20px; right: 20px;'>欢迎使用LapPHP V1.0.0   By DreamBoy<span></p>";

			$this->display();
		}

		function check() {
			$admin = M('Admin'); //检查是否有错误提示
			if($res = $admin->check()) { //验证失败!有错误提示
				$this->assign('err', $res);
				$this->display('Index/index');
			} else {
				$this->redirect('Index/adminShow');
			}
		}

		/**
		 * 验证是否登陆过
		 * @return boolean [description]
		 */
		function isLogin() {
			session_start();
			if(!$this->validate($_SESSION['account'])) {
				$this->assign('err', '请先登录!')->display('Index/index');
			}
		}

		//显示所有信息
		function show() {
			$this->isLogin();

			$students = M('Students');
			$cur = 1; //当前页数第一页
			if($this->validate($_GET['cur'])) {
				$cur = $_GET['cur'];
			}
			$res = $students->page($cur);
			$this->assign('res', $res)->assign('start', ($cur-1) * $students->getEachPageLen() + 1)->assign('prePage', $cur-1)->assign('nextPage', $cur+1)->display('Index/showStudent');
		}

		//显示所有信息+删除操作
		function adminShow() {
			$this->isLogin();

			$students = M('Students');
			$cur = 1; //当前页数第一页
			if($this->validate($_GET['cur'])) {
				$cur = $_GET['cur'];
			}
			$res = $students->page($cur);
			$this->assign('res', $res)->assign('start', ($cur-1) * $students->getEachPageLen() + 1)->assign('prePage', $cur-1)->assign('nextPage', $cur+1)->display('Index/admin');
		}

		//删除学生题目
		function del() {
			//print_r($_POST['sno']);
			$admin = M('Admin');
			$res = $admin->del();
			if($res == 1) {
				$this->assign('info', '删除成功!');
			} else if($res == -1) {
				$this->assign('info', '删除失败!');
			} else if($res == 0) {
				$this->assign('info', '没有删除任何数据');
			}
			$this->adminShow();
		}
	}
?>

Application/Admin/Model/AdminModel.class.php

<?php
	class AdminModel extends Model {
		private static $err = array('account'=>'管理员账号不能为空!', 'psw'=>'管理员密码不能为空!', 'none'=>'该账号不存在!', 'pswErr'=>'密码错误!');

		function check() {
			//验证管理员账号是否为空
			if(!$this->validate(daddslashes($_POST['account']))) {
				return self::$err['account'];
			}

			//验证管理员密码是否为空
			if(!$this->validate(daddslashes($_POST['psw']))) {
				return self::$err['psw'];
			}

			$account = daddslashes($_POST['account']);
			$psw = daddslashes($_POST['psw']);
			$sql = "SELECT `psw` FROM `admin` WHERE `account`='$account'";
			$res = $this->execute_dql_arr($sql);
			if($this->validate($res)) {
				if($res[0]['psw'] != $psw) {
					return self::$err['pswErr'];
				}
			} else {
				return self::$err['none'];
			}

			//验证通过
			session_start();
			$_SESSION['account'] = $account;
			return '';
		}

		//删除学生题目
		function del() {
			if($this->validate($_POST['sno'])) {
				$snoArr = $_POST['sno']; //获取用户选择的sno数组
				$snos = implode(',', $snoArr);
				$sql = "DELETE FROM `students` WHERE `sno` IN ($snos)";
				$res = $this->execute_dml($sql);
				if($res == 1) {
					return 1; //新增题目成功
				} else {
					return 0; //新增题目失败
				}
			} else {
				return -1; //没有题目可删除
			}
		}
	}
?>

Application/Admin/Model/StudentsModel.class.php

<?php
	class StudentsModel extends Model {
		private $eachPageLen = 15;

		//分页查询数据
		function page($cur) {
			$length = $this->eachPageLen;
			$offset = ($cur - 1) * $length;
			$sql = "SELECT * FROM students ORDER BY sno LIMIT $offset,$length";
			return $arr = $this->execute_dql_arr($sql);
		}
		//得到每页的页数
		function getEachPageLen() {
			return $this->eachPageLen;
		}
	}
?>

Application/Admin/View/Index/admin.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计后台管理系统</title>

    <!-- Bootstrap -->
    <link href="Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="Public/style.css" rel="stylesheet" type="text/css"/>
    <style>
      p.info {
        margin-bottom: 0;
      }
    </style>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
	<div class="container">
      <div class="content">
        <?php
          if($info) {
        ?>
             <p class="info"><marquee behavior="scroll" direction="left"><span style="font-weight: bold">消息:</span><?php echo $info;?></marquee></p>
        <?php
          }
        ?>
        <form action="index.php?m=Admin&a=del" method="POST">
          <table class="table table-hover">
            <caption><h3>学生课程设计题目</h3></caption>
            <?php
              if(!isset($res) || empty($res)) {
                echo '<tr><td>暂无学生题目</td></tr>';
              } else {
            ?>
            <thead>
              <tr>
                <th>删除</th>
                <th>序号</th>
                <th>学号</th>
                <th>姓名</th>
                <th>题目</th>
                <th>状态</th>
                <th>录入时间</th>
                <th>合作学生</th>
              </tr>
            </thead>
            <tbody>
              <?php
                $i = $start ? $start : 1;
                foreach ($res as $value) {
                  echo '<tr>';
                  echo '<td><input type="checkbox" name="sno[]" value="' . $value['sno'] . '"/></td>';
                  echo "<th scope='row'>$i</th>";
                  echo "<td>{$value['sno']}</td>";
                  echo "<td>{$value['name']}</td>";
                  echo "<td>{$value['title']}</td>";
                  echo "<td>{$value['state']}</td>";
                  echo "<td>{$value['last_time']}</td>";
                  echo "<td>{$value['partner']}</td>";
                  echo '</tr>';
                  $i++;
                }
              ?>
            </tbody>
            <?php
              }
            ?>
          </table>
          <nav>
            <ul class="pager">
              <li>
                <?php
                  if($prePage) {
                    if($prePage >= 1) {
                      echo "<a href='index.php?m=Admin&a=adminShow&cur=$prePage'>上一页</a>";
                    }
                  }
                ?>
              </li>
              <li>
                <?php
                  if($nextPage) {
                    if($nextPage >= 1) {
                      echo "<a href='index.php?m=Admin&a=adminShow&cur=$nextPage'>下一页</a>";
                    }
                  }
                ?>
              </li>
            </ul>
          </nav>
          <a href="index.php?m=Admin">返回登陆界面</a>     <input class="btn btn-default" type="submit" value="确认删除"/>
        </form>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="Public/js/bootstrap.min.js"></script>
  </body>
</html>

Application/Admin/View/Index/index.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计后台管理系统</title>

    <!-- Bootstrap -->
    <link href="Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="Public/style.css" rel="stylesheet" type="text/css"/>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <div class="container">
      <div class="col-sm-3"></div>
      <div class="col-sm-6 content">
        <h2>课程设计题目统计后台管理系统</h2>
        <form class="form-horizontal" action="index.php?m=Admin&a=check" method="POST">
          <div class="form-group">
            <label for="number" class="col-sm-3 control-label">管理员账号:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="number" placeholder="请输入管理员账号" name="account">
            </div>
          </div>
          <div class="form-group">
            <label for="password" class="col-sm-3 control-label">修改密码:</label>
            <div class="col-sm-9">
              <input type="password" class="form-control" id="password" placeholder="请输入管理员密码" name="psw">
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
              <button type="submit" class="btn btn-info">登陆</button>   
              <a href="index.php?m=Admin&a=show">显示全部学生题目</a>
            </div>
          </div>
          <?php
            if($err) {
          ?>
               <p class="info"><span style="font-weight: bold">错误:</span><?php echo $err;?></p>
          <?php
            }
          ?>
        </form>
      </div>
      <div class="col-sm-3"></div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="Public/js/bootstrap.min.js"></script>
  </body>
</html>

Application/Admin/View/Index/showStudent.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计系统</title>

    <!-- Bootstrap -->
    <link href="Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="Public/style.css" rel="stylesheet" type="text/css"/>
    <style>
      p.info {
        margin-bottom: 0;
      }
    </style>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
	<div class="container">
      <div class="content">
        <table class="table table-hover">
          <caption><h3>学生课程设计题目</h3></caption>
          <?php
            if(!isset($res) || empty($res)) {
              echo '<tr><td>暂无学生题目</td></tr>';
            } else {
          ?>
          <thead>
            <tr>
              <!-- <th>删除</th> -->
              <th>序号</th>
              <th>学号</th>
              <th>姓名</th>
              <th>题目</th>
              <th>状态</th>
              <th>录入时间</th>
              <th>合作学生</th>
            </tr>
          </thead>
          <tbody>
            <?php
              $i = $start ? $start : 1;
              foreach ($res as $value) {
                echo '<tr>';
                echo "<th scope='row'>$i</th>";
                echo "<td>{$value['sno']}</td>";
                echo "<td>{$value['name']}</td>";
                echo "<td>{$value['title']}</td>";
                echo "<td>{$value['state']}</td>";
                echo "<td>{$value['last_time']}</td>";
                echo "<td>{$value['partner']}</td>";
                echo '</tr>';
                $i++;
              }
            ?>
          </tbody>
          <?php
            }
          ?>
        </table>
        <nav>
          <ul class="pager">
            <li>
              <?php
                if($prePage) {
                  if($prePage >= 1) {
                    echo "<a href='index.php?m=Admin&a=show&cur=$prePage'>上一页</a>";
                  }
                }
              ?>
            </li>
            <li>
              <?php
                if($nextPage) {
                  if($nextPage >= 1) {
                    echo "<a href='index.php?m=Admin&a=show&cur=$nextPage'>下一页</a>";
                  }
                }
              ?>
            </li>
          </ul>
        </nav>
        <a href="index.php?m=Admin">返回登陆界面</a>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="Public/js/bootstrap.min.js"></script>
  </body>
</html>
时间: 2024-12-27 19:17:01

我的LabPHP框架的Demo应用——课程设计题目统计系统的相关文章

数据结构课程设计题目四_二叉树

本文出自:http://blog.csdn.net/svitter 题目4:二叉树 给出一颗无线的二叉树.树的每一个结点用一整数对标识.二叉树构造如下 树根被标识为(1, 1): 如果一个结点被标识为(a, b), 则其左孩子被标识为(a+b,b),右孩子被标识为(a, a+b).现在给出某一结点(a, b),求树根到该结点的最短路径,并且同时求出从树根出发向左走和向右走的次数.建议完成人数1人. 注:此处使用了STL_stack库函数,是不允许的,我图方便. //===============

数据结构课程设计题目十二_计算机学院学生会的打印机(优先队列)

本文出自:http://blog.csdn.net/svitter 题目12:计算机学院学生会的打印机(优先队列) 小明抱怨学生会的打印机不符合FIFO的原则,看到很多在他后面来打印的同学比他先打印出来.五分钟前,小明的文件就是下一个候选的,如今小明的文件又排到了后面.学生会的同学给小明解释说,学生会的打印机不是採用传统的队列方式,而是採用一种自定义的优先队列方式:每一个要打印的文件被赋予了一个从1到9的优先级(9最高,1最低).打印规定例如以下: 将队列中要打印的文件f从队列中拿出来: 假设在

C++课程设计-银行储蓄系统

*  课程设计概述 */ *  C++课程设计: *  银行储蓄系统 * *  功 能 介 绍: *  面向用户版的银行系统,模拟自己进入银行时相关的操作. *  首次进入银行时,需要办理相应的银行卡.    *  当用户有银行卡后,可以办理银行有的一般业务. *  业务包括:查询.存款.取款.转账.销户 *                 挂失.解挂.改密. *  同时设置了管理员的一个功能,查询银行所有账户的信息. * *  功能实现 :    *  文件保存与读取 *  为了更好的模拟真实

课程设计--银行储蓄系统

介绍: 银行储蓄系统包括:支持多名储户开户.存款.取款.转帐.改密.挂失.解挂.销户等功能. 登录 输入业务员用户名和密码.3次输入不正确,强制退出程序. 基本要求 可以只设一名业务员,用全局变量表示其用户名和密码,写在程序中. 系统菜单 当业务员信息验证后,进入到系统主控菜单,由业务员为储户办理各种业务,直到按0后退出. 基本要求 每次启动系统,都是从0用户开始办理业务 开户 账号由系统自动分配 确认密码和密码不同时要拒绝. 开户后,账号状态为0-正常 销户 输入账号,确认后,将余额全部取完,

课程设计题目及可行性研究报告的任务分配

1 题目 毕业设计管理信息系统 毕业设计是高校教学中一个重要阶段.毕业设计包括论文选题.论文开题.答辩管理.成绩统计以及有关的通知.规定等.为加强毕业设计的管理,使毕业设计管理自动化,网络化,急需开发一个本科毕业设计管理信息系统. 系统需求为: (1)指导教师网上上报论文题目: (2)学生网上选题及选指导老师,管理员确定学生及导师名单: (3)生成开题及答辩分组名单: (4)可以进行各项成绩统计: (5)多用户管理: (6)各种文件的上传和下载: (7)提供有关毕业设计的规定.相关知识等信息.

asp.net,java,jsp,安卓Android,苹果ios,php,vb.net,c#免费毕业课程设计源码共享网盘下载

百度网盘下载地址1:  http://pan.baidu.com/s/1o67fybC 百度网盘下载地址2: http://pan.baidu.com/s/1kTxckmF163网盘下载地址:http://home.163disk.com/shuangyulin file://E:\计算机设计参考!!!!!!!!!!!\资料 (4 folders, 0 files, 0 bytes, 641.25 MB in total.) ├─QQ254540457 (0 folders, 49 files,

计算机毕业课程设计源码打包下载

下载地址1: http://dl.vmall.com/c06pluqz6r 10个数据结构课程设计实例二...冒泡排序快速排序等.rar  下载  9.99K asp+sqlserver2000网络书店系统.rar  下载  1.4M asp+sqlserver2000在线考试系统.rar  下载  1.21M ASP+sql精品在线试题库设计+论文.rar  下载  2.7M asp.net+sql2008在线论坛系统.rar  下载  3.09M asp.net_sql2008公司人事管理系

数据结构——课程设计

  <数据结构课程设计>   课程题目 模拟电话客服管理系统 课程编号 j1620102 学生姓名 吴佳煜 所在专业 信息管理与信息系统 所在班级 信管1133 任课老师 易学明 实习时间 二〇一四年十二月二十五日 设计成绩 老师评语 一.课程设计题目 赵斌是一个信管专业的学生,大学四年顺利毕业了.在毕业季,他也像其他学子一样,投身于求职大军,投出一份又一份求职简历,在苦苦地等待之后,他接到了中国移动通信公司广东分司的面试通知书,通知他于本月1号10点到公司面试.当天,晴空万里,艳阳高照,他身

课程设计(物体类),图片可能没有加载出来,自己运行一下就行了

一.课程设计题目与要求(包括题目与系统功能要求) A.<1>设计如下类,其功能和部分成员如下: Object:抽象类,所有的物体都有价值(profit)属性: Point:点的位置: Line(线段),Rectangle,Cuboid, Square,Cube,Circle,Cylinder. <2>功能:能够实现上述物体的移动(move),放大(zoomin),缩小(zoomout),大小比较(compare),打印物品信息(cout<<编号.面积.容积和价值)等操作