php怎么判断是不是手机号
php怎么判断是不是手机号
肯定要用正则表达式解决了。
$g = "/^1[34578]\d{9}$/"
上面是正则表达式,那怎么用PHP来写呢?
$g = "/^1[34578]\d{9}$/" if(preg_match($g, $mobile)){ echo '是手机号。'; }
这样就可以了。
zhangsir版权f2防采集https://mianka.xyz肯定要用正则表达式解决了。
$g = "/^1[34578]\d{9}$/"
上面是正则表达式,那怎么用PHP来写呢?
$g = "/^1[34578]\d{9}$/" if(preg_match($g, $mobile)){ echo '是手机号。'; }
这样就可以了。
zhangsir版权f2防采集https://mianka.xyz1.使用array_unique方法进行去重对数组元素进行去重,我们一般会使用array_unique方法,使用这个方法可以把数组中的元素去重。<?php $arr = array(1,1,2,3,3,3,4,4,5,6,6,7,8,8,9,9,9); $arr&nbs...
PHP中,如果要下载的文件名称为中文,则会出现文件标题乱码。此时就需要对标题进行编码,也就是说先进性urlencode,然后再放入header,然后问题就解决了。$filename = urlencode("下载文档"); header (&nbs...
php实现返回上一页的功能的3种有效方法header(location:你的上一页的路径); // 注意这个函数前不能有输出 header(location:.getenv(&quo...
1.首先用composer下载PHPMailer,在网站根目录进入命令行输入如下命令即可composer require phpmailer/phpmailer2.然后创建文件Ma.php,填写如下代码<?php namespace app\controller...
这是因为thinkphp官方升级了thinkphp版本的原因,只需要更新Filesystem类就行了更新命令行如下:composer require topthink/think-filesystem 1.0.1...