txt文件格式如下

13000000000,13000000005,13000000403,13001010129,13001010688,13001010838,13001016389,13001019538,13001030005,13001042700,13001047495,13001049871,13001072727,13001086166,13001103598,13001108955,13001119191,13001119326,13001119381,13001122997,13001125733,13001128598,13001133352,13001159788,13001163638,13001194012,13001200791,13001206309,13001220631,13001222221,13001225210,13001236066,13001242996,13001267978,13001272366,13001279525,13001286377,13001286907,13001303126,13001304654,13001306970,13001313257,13001315988,13001328069,13001339578,13001359703,13001367655,13001397796,13001419112,13001423823,13001433363,13001452385,13001499722,13001505123,13001522177,13001544895,13001551007,13001556934,13001579390,13001590367,13001598184,13001600804,13001608962,13001609052,13001627116,13001631483,13001656358,13001672087,13001681870,13001683508,13001698397,13001707688,13001710692,13001712288,13001719420,13001727188,13001741837,13001742180,13001751202,13001751737,13001751792,13001771448,13001778810,13001785513,13001789795,13001793614,13001793714,13001794854,13001795467,13001796034,13001796475,13001796554,
<?php

        $handle = fopen("mobile.txt", "r") or die("Couldn't get handle");

        $mobiles = [];

        $stime = microtime(true);
        $param = '';
        $next = false;
        $page = 1;

        if ($handle) {
            while (!feof($handle)) {

                $buffer = fgets($handle, 500);

                // Process buffer here..
                preg_match_all('/\d+/', $buffer, $match);

                if (empty($match['0'])) {
                    break;
                }

                //如果最后一个不是逗号
                if (substr($buffer, -1, 1) != ',') {
                    $next = true;
                    //判断是不是到最后的一行
                    $param = array_pop($match['0']);
                }

                if ($next && $page > 1) {
                    //如果第一个不是逗号
                    if (substr($buffer, 0, 1) != ',') {
                        $param = $param . array_shift($match['0']);
                    }

                    $mobiles[] = $param;
                    $next = false;
                    $param = '';
                }

                foreach ($match['0'] as $v) {
                    $mobiles[] = $v;
                }

                unset($buffer);
                $page++;
            }
            fclose($handle);
        }

        if ($next && !empty($param)) {
            $mobiles[] = $param;
        }
        p($arr[0]);
        echo count($arr) . "个手机号 \n";

file

解决 laravel-admin between datetime 假如数据库是时间戳int类型无法筛选。

laravel-admin默认的between->datetime(),查询默认是datetime类型,但是假如数据库是时间戳类型就会报错,又不想改底层文件的话可以试试加自定义筛选功能...

阅读全文

php解析英文语句,自动分解。

参考:https://www.php.net/manual/en/function.str-split.php 最近碰到一个问题,客户的英文地址太长,超出接口api字段长度,所以需要解析下语句分解发送。 ...

阅读全文

记录一个laravel-excel导出表格值为0导出excel显示空的解决方法。

最近在使用laravel-excel导出表格的时候,发现假如字段值为0的情况下,导出的excel中直接显示为空,找到一个方法解决,如下. 在laravel-excel的config配置中...

阅读全文

欢迎留言