request->isPost()){ return show(config("status.error"),"请求方式错误"); } //参数验证 1、原生方式 2、TP6验证机制 //原生方式 $username = $this->request->param("username","","trim"); $password = $this->request->param("password","","trim"); $captcha = $this->request->param("captcha","","trim"); if(empty($username) || empty($password) || empty($captcha)){ return show(config("status.error","参数不能为空")); } //需要校验验证码 if(!captcha_check($captcha)){//中间件中 session 需要开启才能正常验证 //验证码校验失败 return show(config("status.error"),"验证码不正确"); } return show(config("status.error"),"登录成功"); } }