如何创建需要访问其他字段值的Symfony验证器?(How do I create a Symfony validator that needs to access other fields valu

编程入门 行业动态 更新时间:2024-10-28 04:16:08
如何创建需要访问其他字段值的Symfony验证器?(How do I create a Symfony validator that needs to access other fields values?)

我想实现一个验证注册表单密码的Symfony验证器,这意味着我需要一个“密码确认”字段。 如何制作一个以某种方式将这些字段联系在一起的验证器? 我需要检查密码和密码是否确认值匹配。

在Symfony中如何正确实现这些内容?

I want to implement a Symfony validator that validates passwords for a registration form, which means I want a 'Password confirm' field. How do I make a validator that somehow ties these fields together? I need to check if the password and password confirm values match.

How are stuff like these implemented properly in Symfony?

最满意答案

您可以使用postValidator。 查看文档,有一个密码确认验证的示例。

You can use a postValidator . Check the documentation, there is an example with the password confirm validation.

更多推荐

本文发布于:2023-07-31 09:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1342576.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   create   Symfony   validator   fields

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!