我有一个在后端执行验证的联系表单,我要检查的是用户是否已成功完成验证码,如果没有打印错误消息。
目前,我收到一条错误消息:
Notice: Undefined index: g-recaptcha-response in /var/www/html/mangoForm.php on line 99
所以它不会打印 JSON 中的错误消息:
{"success":false,"errors":{"captcha":"ReCaptcha is required."}}
第 99 行:
$captcha = checkCaptcha($formData['g-recaptcha-response']);
有问题的代码块:
if (!empty($validationMSG)) {
return $validationMSG;
}
else {
$captcha = checkCaptcha($formData['g-recaptcha-response']);
if(!$captcha['isSuccess']){
$validationMSG['captcha'] = 'ReCaptcha is required.';
return $validationMSG;
}
//End of Validation Function
}
}
慕尼黑5688855