Skip to content

单字段多规则中,正则的值,能否用变量? #41

Description

@ZhangChengLin
$MultipleRules = [
    ['captchaCode', 'fixedSize:4', 'msg' => $msg],
    ['username', 'required|string:3,15|regexp:{$regexp["username"]}', 'msg' => $msg],
//    ['username', 'required|string:3,15|regexp:^[a-zA-Z]\w{4,19}$', 'msg' => $msg],
    ['password', 'required|string:8,20|regexp:{$regexp["password"]}', 'msg' => $msg],
];

比如说 {$regexp["username"]}

不能这么写吗?

Activity

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions