'require', 'verify_code|验证码' => 'require|checkCode' ]; public function checkCode($value, $rule, $data = []): bool { if (!devAuth() && !CaptchaUtil::check($data['uuid'], $value)) { throw new ValidateException("图形验证码错误"); } return true; } }