php商品管理系统代码(php学生管理系统源码免费)

项目名称:基于PHP MySQL的学生信息管理系统

本系统是一个用于管理学生信息的管理系统,包括基本的增删改查,系统使用PHP语言开发,使用MySQL数据库,可以供初学者参考使用。

系统环境

MySQL5.1.51-community

PHP7.3.29

运行截图

1.登录页面

php商品管理系统代码(php学生管理系统源码免费)

2.首页

3.添加学生

4.修改学生

5.项目结构

核心代码

LoginController

<?phpinclude ‘../dao/LoginDao.php’;include ‘../bean/Res.php’; header(“Content-Type: application/json;charset=UTF-8”); // 从请求中获取原始数据$json = file_get_contents(‘php://input’); // 将其转换为 PHP 对象$data = json_decode($json);//$param = json_encode($data); $loginDao = new LoginDao();$res = $loginDao->login($data->uname, $data->upass); $result = new Res();if($res){ $result->setSuccess(true); $result->setData(“登录成功”);}else{ $result->setSuccess(false); $result->setData(“登录失败”);}echo json_encode($result);?>

StudentController

<?phpinclude ‘../bean/User.php’;include ‘../dao/StudentDao.php’; header(“Content-Type: application/json;charset=UTF-8”); // 从请求中获取原始数据$json = file_get_contents(‘php://input’); // 将其转换为 PHP 对象$param = json_decode($json); $method = $param->method; $studentDao = new StudentDao();$res = new Res(); switch ($method){ case ‘queryAll’: //查询全部 $res->setData($studentDao->queryAll()); $res->setSuccess(true); break; case ‘save’: //保存 $res->setData($studentDao->save($param)); $res->setSuccess(true); break; case ‘update’: //更新 $res->setData($studentDao->update($param)); $res->setSuccess(true); break; case ‘delete’: //删除 $res->setData($studentDao->delete($param)); $res->setSuccess(true); break;} echo json_encode($res); ?>

发表评论

登录后才能评论