php判断是否四到11位数字

WBOY
Release: 2016-06-13 12:12:00
Original
1165 people have browsed it

php判断是否4到11位数字
php判断是否4到11位数字
php判断是否是5到20位数字字母下划线减号
------解决思路----------------------
preg_match('/^\d{4,11}$/', $text)
preg_match('/^[\w-]{5,20}$/', $text)


------解决思路----------------------
preg_match返回1,匹配到了,是正确的,改为:
if(!preg_match('/^\d{4,11}$/', $text)){write_msg("QQ号格式不正确"); }

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