mohammadv184 / arcaptcha
ArCaptcha 的 PHP 库
v1.0.2
2021-08-08 11:55 UTC
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^7.3
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2024-09-19 22:41:31 UTC
README
PHP ArCaptcha 库。此包支持 PHP 7.3+。
内容列表
安装
使用 composer 安装此包
composer require mohammadv184/arcaptcha
配置
您可以通过传递 API 中的 SiteKey 和 SecretKey 创建一个新实例。您可以在 https://arcaptcha.ir/dashboard 获取
use Mohammadv184\ArCaptcha\ArCaptcha; $ArCaptcha = new ArCaptcha($siteKey, $secretKey);
如何使用
如何使用 ArCaptcha。
小部件使用
要在表单上显示 ArCaptcha,请使用类来渲染脚本标签和小部件。
<?php echo $ArCaptcha->getScript() ?> <form method="POST"> <?php echo $ArCaptcha->getWidget() ?> <input type="submit" value="Submit" /> </form>
验证响应
提交后,请使用类来验证响应。您将返回 true 或 false
if ($ArCaptcha->verify($_POST["arcaptcha-token"])) { echo "OK!"; } else { echo "FAILED!"; }
致谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 以获取更多信息。