1

我在 Xampp 上使用 PHP 进行本地开发。

我正在尝试使用recaptcha

我需要公钥和/或私钥吗?

提前致谢。

4

1 回答 1

2

为了使用 reCAPTCHA,您需要一个公共/私有 API 密钥

使用PHP Library显示验证码:

require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);

然后验证:

require_once('recaptchalib.php');
$privatekey = "...";
$resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);
于 2010-01-27T18:23:29.713 回答