惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
GbyAI
GbyAI
I
InfoQ
C
Cisco Blogs
T
Tor Project blog
NISL@THU
NISL@THU
N
Netflix TechBlog - Medium
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
H
Help Net Security
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
A
Arctic Wolf
Stack Overflow Blog
Stack Overflow Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Palo Alto Networks Blog
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
P
Privacy International News Feed
L
LINUX DO - 热门话题
Know Your Adversary
Know Your Adversary
L
LangChain Blog
AWS News Blog
AWS News Blog
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
U
Unit 42
P
Privacy & Cybersecurity Law Blog
Spread Privacy
Spread Privacy
WordPress大学
WordPress大学
Latest news
Latest news
L
Lohrmann on Cybersecurity
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Y
Y Combinator Blog
S
SegmentFault 最新的问题
Recent Announcements
Recent Announcements
C
Cybersecurity and Infrastructure Security Agency CISA
Martin Fowler
Martin Fowler
S
Schneier on Security
C
CERT Recently Published Vulnerability Notes
B
Blog
Project Zero
Project Zero
Recorded Future
Recorded Future

博客园 - 雾里寻踪

【问题】/usr/bin/env: php: 没有那个文件或目录 Centos下nginx支持https协议 PHP下生成非重复的id PHP的Enum(枚举)的实现 关于苹果safari浏览器登陆时Cookie无法保存的问题 关于jquery在页面初始化时radio控件选定默认值的问题 【转】线程池与工作队列 【转】移动发送短信的状态报告 【转】如何利用C#编写网页投票器程序|如何使用代理来投票|代理IP来投票 【转】修改内存地址内容,可以修改游戏金币值 【原创】关于mysqlcheck使用 【转】新手入门:关于C++中的内联函数(inline) 【转】面向Java开发人员的Flex开发指南 【转】使用 Eclipse C/C++ Development Toolkit (CDT)开发应用程序 【转】用 Eclipse 平台的CDT控件进行 C/C++ 开发 【转】漏洞规范及操作系统安全等级划分 【转】PHP 使用header函数设置HTTP头的示例方法 表头 【转】Windows系统下SVN 1.6 服务端和客户端安装配置 【转】Eclipse+CDT+Gcc编译选项控制
PHP下的手机号码效验
雾里寻踪 · 2015-03-18 · via 博客园 - 雾里寻踪

手机号是否合法有效,基本都是用正则匹配的,所以正则表达式是关键,可以用到java、c#等语言里。

    /**
     * 验证手机号是否合法
     *
     * @param string $mobile
     *            验证的手机号
     * @return bool true or false
     */
    public static function is_mobile($mobile)
    {
        // 手机号码的正则验证
        if (preg_match("/^13[0-9]{9}$|15[0-9]{9}$|18[0-9]{9}$|14[57]{1}[0-9]{8}$|17[0678]{1}[0-9]{8}$/", $mobile)) {
            // 验证通过
            return true;
        } else {
            // 手机号码格式不对
            return false;
        }
    }

posted on 2015-03-18 09:20  雾里寻踪  阅读(327)  评论(0)    收藏  举报

刷新页面返回顶部