zoneroot/recaptcha

简单的 recaptcha 类

dev-master 2015-01-17 00:24 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:36:18 UTC


README

简单的 recaptcha 静态 PHP 类。

安装

使用 composer

"zoneroot/recaptcha": "dev-master"

使用方法

首先你需要用你的密钥初始化 recaptcha

use \zoneroot\recaptcha\recaptcha;
recaptcha::init("public key", "private key");

然后在你的 head 标签中插入

echo recaptcha::script()

接下来在你的 form 标签中插入

echo recaptcha::html()

最后你必须检查验证码是否有效

try {
	recaptcha::check()
	echo "Captcha is valid";
} 
catch (\zoneroot\recaptcha\exceptions\invalidRecaptchaException $e) {
	echo $e->getMessage();
}
catch (\zoneroot\recaptcha\exceptions\connectionException $e) {
	echo $e->getMessage();
}

贡献

为了贡献,只需遵循代码风格。

待办事项

添加一些注释

####受以下启发 grafikart