In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to hide a few digits in php. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Php to achieve hidden number of several methods: 1, to create a PHP sample file; 2, through the "function hidtel ($phone) {...}" method to hide the phone number and mobile phone number between 4 digits.
This article operating environment: Windows7 system, PHP7.1, Dell G3 computer.
PHP hides the middle 4 digits of phone number / mobile number
/ * 1, hide the middle 4 digits of the phone number and mailbox * / function hidtel ($phone) {/ / hide mailbox if (strpos ($phone,'@')) {$email_array = explode ("@", $phone); $prevfix = (strlen ($email_array [0]))
< 4) ? "" : substr($phone, 0, 3); //邮箱前缀 $count = 0; $str = preg_replace('/([\d\w+_-]{0,100})@/', '***@', $phone, -1, $count); $rs = $prevfix . $str; return $rs; } else { //隐藏联系方式中间4位 $Istelephone = preg_match('/(0[0-9]{2,3}[\-]?[2-9][0-9]{6,7}[\-]?[0-9]?)/i', $phone); //固定电话 if ($Istelephone) { return preg_replace('/(0[0-9]{2,3}[\-]?[2-9])[0-9]{3,4}([0-9]{3}[\-]?[0-9]?)/i', '$1****$2', $phone); } else { return preg_replace('/(1[0-9]{1}[0-9])[0-9]{4}([0-9]{4})/i', '$1****$2', $phone); } } } /** * 2、使用hidtel */ public function useHidel() { $phone1 = $this->Hidtel ("010-57033050"); $phone2 = $this- > hidtel ("01057033050"); $mobil = $this- > hidtel ("13661226666"); $email = $this- > hidtel ("1963632356@qq.com"); return $phone1.''.$phone2.''.$mobil.''.$email;}
Effect:
/ / the rule determines whether it is verified when the mailbox, mobile phone number and user account log in.
$checkmail ='/\ w+ ([- +.]\ w+) * @\ w+ ([-.]\ w+) *\.\ w+ ([-.]\ w+) * /'; / / whether the mailbox if (preg_match ($checkmail,$userName)) {$type = 'email'; $value = $userName } elseif (preg_match ("/ ^ 1 [34578]\ d {9} $/", $userName)) {/ / whether the mobile number $type = 'mobile'; $value = $userName;} else {$type =' user_name'; $value = $userName } this is the end of the article on "how to hide several numbers in php". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.