arrilot/google-recaptcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arrilot/google-recaptcha

Composer 安装命令:

composer require arrilot/google-recaptcha

包简介

关键字:

README 文档

README

Latest Stable Version Total Downloads Build Status

Abstraction Layer for google reCAPTCHA 2

Installation

  1. composer require arrilot/google-recaptcha

  2. Somewhere during bootstrap

\Arrilot\GoogleRecaptcha\Recaptcha::getInstance()
    ->setPublicKey('6Lf1_...')
    ->setSecretKey('6Lf1_...')
    ->setLanguage('ru');

Usage example

<?php

function recaptcha()
{
    return \Arrilot\GoogleRecaptcha\Recaptcha::getInstance();
}
?>

<? if (isset($_POST['g-recaptcha-response'])): ?>

    <h2>POST data</h2>
    <kbd><pre><? var_export($_POST); ?></pre></kbd>
    <? if (recaptcha()->verify()): ?>
        <h2 style="color:green">Success!</h2>
    <? else: ?>
        <h2 style="color:red">Something went wrong</h2>
        <pre><? var_export(recaptcha()->getErrors()); ?></pre>
    <? endif ?>

<? else: ?>

    <p>Complete the reCAPTCHA then submit the form.</p>
    <form action="/captcha/index2.php" method="post">
        <fieldset>
            <legend>An example form</legend>
            <p>Example input A: <input type="text" name="ex-a" value="foo"></p>
            <p>Example input B: <input type="text" name="ex-b" value="bar"></p>
            
            <?= recaptcha()->getHtml(['size' => 'compact']) ?>
            <?= recaptcha()->getScript() ?>
            <p><input type="submit" value="Submit" /></p>
        </fieldset>
    </form>

<?endif; ?>

统计信息

  • 总下载量: 6.68k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固