forms - 使用 Symfony 3 在 HTML 中添加验证码
问题描述
嗨,我想在 Symfony 3.4 项目中以 html 形式使用验证码,我成功安装并实现了验证码包(Gregwar 的 CaptchaBundle),但在包的文档中,将验证码添加到他们正在使用 symfony 表单生成器的表单中但我正在使用 requests 处理普通的 HTML 表单。这是他们在捆绑包文档中提供的代码:
<?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ...
$builder->add('captcha', CaptchaType::class); // That's all !
// If you're using php<5.5, you can use instead:
$builder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');
// ...
这是我要在其中添加验证码的 html 表单
<form class="row" method="post" action="{{path('envoyerchat')}}">
<input type="text" name="test2">
<input type="text" name="test1">
<!-- add captcha here -->
<!-- add captcha here -->
<input type="submit">
</form>
我可以将与 fom builder 一起使用的代码转换为我的 html 表单吗?
解决方案
推荐阅读
- python - Buildozer 和 cython 冲突
- json - JSON 数组存储索引
- typescript - 后一个元素的类型取决于前一个元素的值的元组
- firefox - 为什么我的嵌入字体不能仅在 Firefox 中运行?
- c++ - 解析宏中定义的成员函数中的当前类型
- azure - 单个存储库的 Azure DevOps 权限
- sql - 如何在 SQL 中按开始和结束日期动态过滤记录?
- docker - 通过 ngix 和自定义端口在 https 上运行 owncloud
- xamarin.forms - Xamarin.UITest:如何确定 Xamarin.Forms.ListView 是否正在刷新?
- c# - 如何将 DataTemplate 选择器中的图像按钮命令绑定到 ViewModel?