Heim > Fragen und Antworten > Hauptteil
LauEl2017-09-06 16:30:55
这个地方查询数据库是有问题的 在头部use think\Db; public function checkLogin(Request $request) { //初始化返回参数 $state = 0; $result = ''; $data = $request->param(); $rule = [ 'name|用户名' => 'require', 'password|密码' => 'require', 'verify|验证码' => 'require|captcha', ]; //自定义验证识别的提示信息 $msg = array('name' => array('require' => '用户名不能为空,请检查您的用户名!'), array('password' => array('require' => '密码不能为空,请检查您的密码~')), ); //validate 验证规则 1数据 2规则 3提示 $result = $this->validate($data, $rule, $msg); //如果验证通过执行查询 if ($result === true) { //构造查询条件 $map = [ 'name' => $data['name'], 'password' => md5($data['password']) ]; $user = Db::table('user')->where($map)->find(); if (!$user) { $result = '没有该用户,请检查'; } else { $state = 1; $result = '验证通过,点击[确定]后进入后台'; } } //进行验证 return ['state' => $state, 'message' => $result, 'data' => $data]; }
SEC2017-09-06 13:51:06
错误代码是:Failed to load resource: the server responded with a status of 500 (Internal Server Error)