freddiegar / g-recaptcha
连接/验证 Google Recaptcha 的 PHP 项目库,不依赖于任何特定库
1.0.0
2017-12-20 15:06 UTC
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: >=4.8
This package is auto-updated.
Last update: 2024-09-06 09:03:43 UTC
README
在您的后端项目中实现有效的 g-ReCaptcha 2.0
您可以在文档中查看后端集成的详细信息
使用示例
$params = [ 'secret' => 'YOUR_SECRET_FROM_RECAPTCHA', 'reCaptcha' => $_POST['g-recaptcha-response'] // Optional parameters 'userAgent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36' 'ipAddress' => '127.0.0.1', ]; try { $captcha = new ReCaptcha2($params); $request = $captcha->request(); if ($request->isValid()) { // Dont is bot, ready! } else { $error = $captcha->getErrors(); } } catch (Exception $exception) { $error = $exception->getMessage(); }
侧客户端
您可以在文档中查看前端集成的详细信息