1 回答

TA貢獻1773條經(jīng)驗 獲得超3個贊
第 1 步:確保您已localhost在 Google Captcha V2 儀表板中添加您的域。
第2步:
我正在修改你的功能,你可以像這樣使用它:
public function validate_captcha()
{
if(isset($_POST['g-recaptcha-response']))
{
$captcha=$_POST['g-recaptcha-response'];
}
$secretKey = "Put your secret key here";
$ip = $_SERVER['REMOTE_ADDR'];
// post request to server
$url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha);
$response = file_get_contents($url);
$responseKeys = json_decode($response,true);
// should return JSON with success as true
if($responseKeys["success"]) {
return TRUE;
} else {
return FALSE;
}
}
而不是卷曲
如果這有效,請告訴我
- 1 回答
- 0 關注
- 128 瀏覽
添加回答
舉報