php隐藏手机号中间四位的方法:1、通过“substr_replace($num,'****',3,4);”方法隐藏手机号中间四位;2、通过自定义“yc_phone”函数隐藏中间四位即可。

本文操作环境:Windows7系统、PHP7.1版,DELL G3电脑
php方法 隐藏手机号中间四位
$num = "13966778888" $str = substr_replace($num,'****',3,4);
//自定义函数手机号隐藏中间四位
function yc_phone($str){
$str=$str;
$resstr=substr_replace($str,'****',3,4);
return $resstr;
}在thinkphp模板里的用法:
<span style="font-size:18px;"><volist name="zjd_list" id="vo">
<p>恭喜用户{$vo.user_id|yc_phone=###}砸金蛋获得奖金{$vo.prize}元</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/7fc7563c4182" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">PHP免费学习笔记(深入)</a>”;</p>
</volist></span>【推荐学习:PHP视频教程】











