Solution to the 'Rule Error' prompt when there is '|' in regular verification in ThinkPHP5

黄舟
Release: 2023-03-15 21:34:01
Original
1881 people have browsed it

When there is "|" in the regular rule, it will cause a parsing error:

'regex:\d{3,4}[\s,-]?\d{7,8}|1[3,4,5,8]\d[\s,-]?\d{4}[\s,-]?\d{4}'
Copy after login

Using array syntax can solve it:

['regex' => '\d{3,4}[\s,-]?\d{7,8}|1[3,4,5,8]\d[\s,-]?\d{4}[\s,-]?\d{4}']
Copy after login

The above is the detailed content of Solution to the 'Rule Error' prompt when there is '|' in regular verification in ThinkPHP5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template