amrikasir/googlecapcay

PHP 库用于验证 Google Captcha v2.0

v1.0.0 2017-05-22 05:54 UTC

This package is auto-updated.

Last update: 2024-09-13 16:19:33 UTC


README

Google Capcay 是一个用于验证 Google reCaptcha 的 PHP 库。以下是 Google Capcay 的使用方法:

首先使用 composer 安装

>$ composer require amrikasir/googlecapcay

然后再在 PHP 中使用。

<?php
require_once __DIR__ . '/vendor/autoload.php';

$GoogleCapcay = new GoogleCapcay\GoogleCapcayVerified();

/*
|-------------------------------------------------------------------------------
| Secret Key harus diisi
*/
$GoogleCapcay->SecretKey('Disini Secret Keynya');

/*
|-------------------------------------------------------------------------------
| RespondCode ngak harus diisi, defaultnya ngambil value dari
| $_POST["g-recaptcha-response"]
*/
$GoogleCapcay->RespondCode();

/*
|-------------------------------------------------------------------------------
| Terakhir Verfikasi deh
|
| Return valuenya JSON dari Google Lho..
*/
$GoogleCapcay->Verified();

Google Capcay 支持链式方法

<?php
require_once __DIR__ . '/vendor/autoload.php';

$GoogleCapcay = new GoogleCapcay\GoogleCapcayVerified();

/*
|-------------------------------------------------------------------------------
| Sample Chaining Method
*/
$GoogleCapcay->SecretKey('Disini Secret Keynya')
        ->RespondCode()
        ->Verified();

就是这样,简单直接,就像糖水一样简单哦 :D。

请支持一下哦,这样我们可以继续向前发展。

我们的计划也包含添加 HTML 表单的功能。