Skip to content

Commit 88d1f72

Browse files
author
fangzai
committed
检测手机号码
1 parent 7cad62c commit 88d1f72

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

check_mobile.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
define('SMS_MOBILE_PATTERN', '/^1[3458]\d{9}$/'); //检测手机号正则
3+
$file = file('huiyuan.txt');
4+
$new = fopen('new.txt', "ab");
5+
$no = fopen('no.txt', "ab");
6+
foreach ($file as $mobile) {
7+
$mobile = trim($mobile);
8+
if (empty($mobile)) continue;
9+
//if (!preg_match(SMS_MOBILE_PATTERN , $mobile)) continue;
10+
if (!preg_match(SMS_MOBILE_PATTERN , $mobile)){
11+
fwrite($no, $mobile . "\r\n");
12+
continue;
13+
}
14+
fwrite($new, $mobile . "\r\n");
15+
}
16+
fclose($new);
17+
fclose($no);

0 commit comments

Comments
 (0)