所以我尝试以几种不同的方式将消息添加到lang文件中:
1)
'custom' => array( 'password.regex:' => 'Password must contain at least one number and both uppercase and lowercase letters.')
2)
'custom' => array( 'password.regex' => 'Password must contain at least one number and both uppercase and lowercase letters.')
3)
'custom' => array( 'password.regex:((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20})' => 'Password must contain at least one number and both uppercase and lowercase letters.')
这些都没有奏效.有没有办法做到这一点?
我能够通过使用此方法来解决此问题:'custom' => array( 'password' => array( 'regex' => 'Password must contain at least one number and both uppercase and lowercase letters.' ))
但是我很想知道为什么其他任何一种方法都不起作用,如果有人碰巧知道……?
总结以上是内存溢出为你收集整理的php – Laravel中正则表达式规则的自定义验证消息?全部内容,希望文章能够帮你解决php – Laravel中正则表达式规则的自定义验证消息?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)