具体场景是这样的:后台登录,前三次不需要输入验证码,在登录失败三次后,出现输入验证码的框,并且要验证是否正确。
登录三次失败后:
前端代码(一小段)
后端登录逻辑:
public function index()
{
$model = new UserModel;
$loginError = (int)session('admin_login_error');
if ($this->request->isPost()) {
$captchaObj = new Captcha();
$username = $this->request->post('username/s');
$password = $this->request->post('password/s');
$capt