這里寫描述
public function emailRegister($request)
{
$param = $request->only(['email', 'emailCode','password', 'confirmPassword', 'inviteCode']);
$validate = Validate::rule([
'email' => 'require|email',
'emailCode' => 'require',
'password' => 'require|length:6,32',
'confirmPassword' => 'require|confirm:password',
])->message([
'email.require' => trans('user.validate.email_empty'),
'email.email' => trans('login.validate.email_format'),
'emailCode.require' => trans('user.validate.email_code_empty'),
'password.require' => trans('user.validate.password_empty'),
'password.length' => trans('user.validate.password_length',['%length%' =>'6-32']),
'confirmPassword.confirm' => trans('user.validate.password_confirm'),
]);
if (!$validate->check($param)) {
throw new BadRequestHttpException($validate->getError());
}
}
使用 use think\facade\Validate;
我輸入重復(fù)郵箱正常是返回提示:“電子郵箱已被使用,請重新輸入”
但是重復(fù)點(diǎn)擊提交 經(jīng)常有時候 不是提示 已經(jīng)被使用 而是另外的 郵箱為空的提示;
是不是亂串了?