产生的验证码是有一定要求的,需要客户端无法预测,无法暴力破解,不能从其他的方式得知,保证只能通过从验证码图片上识别才能获得验证码。
解决方案:
后台:生成验证码图片--->base64字符串--->按某规则替换(如+变为=)
返回前台--->前台反向替换放到img中;
注:①替换过程,是为了防止传输过程中的截取;
②后台生成的验证图片,从后台返回,返回的验证码不可破解,因为想破解是要访问验证码接口才能校验的;
③验证码图片是模糊带条条的,干扰机器识别;