php如何实现手机号脱敏(隐藏手机号中间4位) 发布时间:2025/01/11 具体代码如下: function hidePhoneNumber($phoneNumber) { $result = ""; //判断手机号是否正确 if(preg_match("/1\d{10}/", $phoneNumber)){ //使用substr_replace将中间四位替换为* $result = substr_replace($phoneNumber, '****', 3, 4); } return $result; } 复制代码 以上是编程学习网小编为您介绍的“php如何实现手机号脱敏(隐藏手机号中间4位)”的全面内容,想了解更多关于 php入门 内容,请继续关注编程基础学习网。