bhanwarpsrathore / recaptcha
此包已被废弃,不再维护。未建议替代包。
此包最新版本(dev-master)无可用许可证信息。
cakephp 2 的 reCaptcha 插件
dev-master
2023-06-26 05:47 UTC
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2024-01-26 07:41:20 UTC
README
描述
reCAPTCHA 是一项免费的 CAPTCHA 服务,可以保护网站免受垃圾邮件和滥用。
使用说明:首先,在此处注册您的网站的密钥
然后,为了使用 reCaptcha 插件,需要在您的 /app/Config/bootstrap.php
文件中包含以下两行。
Configure::write('Recaptcha.publicKey', 'public-api-key'); Configure::write('Recaptcha.privateKey', 'private-api-key');
将使用 reCaptcha 的控制器需要包含 Recaptcha 组件。通过包含组件,助手将自动对您的视图可用。
public $components = array('Recaptcha.Recaptcha');
在视图中,只需调用助手的 display() 方法来渲染 recaptcha 输入
echo $this->Recaptcha->display();
为了检查结果,在控制器中简单地做类似这样的事情
if ($this->request->is('post')) { if ($this->Recaptcha->verify()) { // verified } else { // display the error } }