若是已,想查本身的公私:
https://www.google.com/recaptcha/admin#list
的,下面三步建立Google reCAPTCHA~
然後在form的action程式面上使用function ,若是false就不登入,就能啦~
段代接到站<head>面
填入名、型、域、管者,同意Google集、建立


- <!-- Google reCAPTCHA -->
- <script src="https://www.google.com/recaptcha/api.js?Onload=onloadCallback2&render=explicit" async></script>
- <script>
- var onloadCallback2 = function() {
- grecaptcha.render("recaptcha_box2", {
- /* Change Your sitekey */
- "sitekey": "公",
- "callback": callback2
- });
- };
-
- function callback2() {
- /* 可履行提交表的作
- alert("恭喜你成功");
- */
- document.getElementById("submit2").disabled = false;
- document.getElementById("submit2").classList.remove('au-btn--gray');
- document.getElementById("submit2").classList.add('au-btn--yellow');
- }
- </script>
代 前去 Google械人官,右上的 「Admin console」按。
下方是到要示的位置
PHP版


STEP I
- // GOOGLE RECAPTHA
- $data['secret'] = '私';
- $data['response'] = $_POST['g-recaptcha-response'];
- $ch = curl_init();
- // 利用CURL
- curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
- curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
- &nbp; curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
- $result = curl_exec($ch);
- curl_close($ch);
- // 解密
- $result = json_decode($result, true);
-
- // 搜是否由程
- if ( ! isset($result['success']) || ! $result['success']) {
- // 失
- echo "<script>alert('械人失!');history.go(-1);</script>";
- exit;
- }
代 STEP II
1.勾我不是械人


- <div id="recaptcha_box2"></div>
代 查建立好的公私: https://www.google.com/recaptcha/admin/site/350731086/settings
文章出
STEP III
文章定位: