野生动物园介绍、动物园门票信息、预定付款、动物园动物信息、动物画廊、园区餐饮、新闻公告、交流讨论、客服。 后台:信息的管理、动物统计、餐饮统计、会员统计。
开发语言:PHP 框架:原生php/thinkphp5 服务器:Apache 数据库:mysql 5.7(一定要5.7版本) 数据库工具:Navicat 11 运行软件:小皮phpStudy 浏览器:谷歌浏览器
源码: /** * 登录接口 * POST * / public function login(){ _REQUEST['username'])?$_REQUEST['username']:""; _REQUEST['password'])?$_REQUEST['password']:""; username."' and password = '".$password."'"; sql); if (row = $result->fetch_assoc()) { $token_array = [ "iat" => time(), //签发时间 "exp" => time()+7200, //token 过期时间 'tablename'=> 'users',//表名 'isAdmin' => 1, 'id' => $row["id"], "success" => $row,//记录的uid的信息,如果有其它信息,可以再添加数组的键值对 ]; token_array)); $data = ['code' => 0, 'token' => data)); } } else { exit(json_encode(['code'=>500,'msg'=>"账号或密码错误"])); } } /* * 退出 * post / public function logout(){ $token = token); exit(json_encode(['code'=>0,'msg'=>'退出成功'])); } /* * 获取session / public function session(){ $token = $this->token(); token),true); $arrayData = $data['success']; arrayData['username']."'"; sql); if (row = row])); } } exit(json_encode(['code'=>0,'data'=>$arrayData])); } /* * 找回密码 重置为123456 / public function resetPass(){ $username = input('post.username'); username."'"; counts); if($cotte->num_rows<1){ exit(json_encode(['code'=>500,'msg'=>"用户名错误。"])); } username."'"; sql); if($result) exit(json_encode(['code'=>500,'msg'=>"重置密码错误。"])); exit(json_encode(['code'=>0,'msg'=>"密码已重置为:123456"])); } / * 分页,列表 * get */ public function page(){ $token = $this->token(); token),true); if (!isset(tokens['id'])) exit(json_encode(['code'=>403,'msg'=>"你还没有登录。"])); $userid = $tokens['id']; _REQUEST['page'])?$_REQUEST['page']:"1"; _REQUEST['limit'])?$_REQUEST['limit']:"10"; _REQUEST['sort'])?$_REQUEST['sort']:"id"; _REQUEST['order'])?$_REQUEST['order']:"asc"; $where = "";//查询条件 where; sql); if ($count->num_rows < 1){ $numberCount = 1; }else{ $numberCount = $count->num_rows; } numberCount/$limt);//页数 page-1)*10; where." order by ".order." limit ".limt; lists); result->num_rows > 0) { while ($datas = arrayData,$datas); } } exit(json_encode([ 'code'=>0, 'data' => [ "total" => $count, "pageSize" => $limt, "totalPage" => $page_count, "currPage" => $page, "list" => $arrayData ] ])); }