该DEMO有隐藏手机号,邮箱和用户名三种方法。调用方法很简单,只要传要隐藏的字符串即可。function hideStar($str) { //用户名、邮箱、手机账号中间字符串以*隐藏 <br>
if (strpos($str, '@')) { <br>
$email_array = explode("@", $str); <br>
$prevfix = (strlen($email_array[0])
$count = 0; <br>
$str = preg_replace('/([\d\w+_-]{0,100})@/', '***@', $str, -1, $count); <br>
$rs = $prevfix . $str; <br>
} else { <br>
$pattern = '/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i'; <br>
if (preg_match($pattern, $str)) { <br>
$rs = preg_replace($pattern, '$1****$2', $str); // substr_replace($name,'****',3,4); <br>
} else { <br>
$rs = substr($str, 0, 3) . "***" . substr($str, -1); <br>
} <br>
} <br>
return $rs; <br>
}
隐藏字符串DEMO:http://www.sucaihuo.com/php/548.html
PHP以星号隐藏用户名手机和邮箱.zip
( 2.02 KB 下载:8 次 )
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
