验证码大小写比对
有时候会生成大写字符串, 没有分区大小写,有什么比较优雅的方法处理,忽略大小写?
用的 strtolower 解决
if (!hash_equals(strtolower($captchaData['code']), strtolower($request->captcha_code))) {
// 验证错误就清除缓存
Cache::forget($request->captcha_key);
throw new AuthenticationException('验证码错误');
}
这验证码本来就应该大小写不敏感,到微信小程序还没有优化这问题