FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

二选一参数必选该用哪个验证器? · Issue #49 · inhere/php-validate · GitHub

二选一参数必选该用哪个验证器? #49

Description

requiredIf
requiredUnless
requiredWith
requiredWithAll
requiredWithout
requiredWithoutAll

比如注册表单中的手机号和邮箱,选填其一。
该如何设置必填项?下面这种可以吗?

    ['email', 'requiredWithoutAll', ['phone']],
    ['email', "string:6,50", 'filter' => $filter],
    ['email', 'email'],

    ['phone', 'requiredWithoutAll', ['email']],
    ['phone', "fixedSize:11", 'filter' => $filter],
    ['phone', 'regexp', "{$regexp['phone']}"],

这种感觉提示结果不是预期想要的二选一提示。
只会提示最后一个被验证的字段提示

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL