PHP 手机号中间4位加密

        很实用,可以用在其他字符串加密。

/**
* 中间加密 字符串截取法
*/
public static function encryptTel($tel) {
$new_tel = substr($tel, 0, 3).'****'.substr($tel, 7); return $new_tel;
} /**
* 中间加密 替换字符串的子串
*/
public static function encryptTel($tel) {
$new_tel = substr_replace($tel, '****', 3, 4); return $new_tel;
} /**
* 中间加密 用正则
*/
public static function encryptTel($tel) {
$new_tel = preg_replace('/(d{3})d{4}(d{4})/', '****', $tel); return $new_tel;
}
    /**
     * 中间加密 字符串截取法
     */
    public static function encryptTel($tel) {
        $new_tel = substr($tel, 0, 3).'****'.substr($tel, 7);        return $new_tel;
    }    /**
     * 中间加密 替换字符串的子串
     */
    public static function encryptTel($tel) {
        $new_tel = substr_replace($tel, '****', 3, 4);        return $new_tel;
    }    /**
     * 中间加密 用正则
     */
    public static function encryptTel($tel) {
        $new_tel = preg_replace('/(d{3})d{4}(d{4})/', '****', $tel);        return $new_tel;
    }
/** * 中间加密 字符串截取法 */ public static function encryptTel($tel) { $new_tel = substr($tel, 0, 3).'****'.substr($tel, 7); return $new_tel; } /** * 中间加密 替换字符串的子串 */ public static function encryptTel($tel) { $new_tel = substr_replace($tel, '****', 3, 4); return $new_tel; } /** * 中间加密 用正则 */ public static function encryptTel($tel) { $new_tel = preg_replace('/(d{3})d{4}(d{4})/', '****', $tel); return $new_tel; }
© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
If you get tired, learn to rest, not to quit.
如果你累了,学会休息,而不是放弃
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容