欧美成人午夜免费全部完,亚洲午夜福利精品久久,а√最新版在线天堂,另类亚洲综合区图片小说区,亚洲欧美日韩精品色xxx

扣丁學(xué)堂PHP培訓(xùn)簡述如何用星號替代用戶名手機(jī)和郵箱

2018-07-23 14:12:58 1263瀏覽

今天扣丁學(xué)堂PHP培訓(xùn)小編給廣大的小伙伴們分享一下如何用星號替代用戶名手機(jī)和郵箱,文章中會有代碼列出,對PHP感興趣的小伙伴下面就隨小編來看一下PHP使用星號替代用戶名手機(jī)和郵箱的實現(xiàn)代碼吧。

扣丁學(xué)堂PHP培訓(xùn)簡述如何用星號替代用戶名手機(jī)和郵箱


PHP使用星號替代用戶名手機(jī)和郵箱這個在許多的活動界面會看到如淘寶的購物界面中的一些客戶的支付寶號都是隱藏掉的哦,下面我們來看一下它的使用方法吧。


<?php 
function hideStar($str) { //用戶名、郵箱、手機(jī)賬號中間字符串以*隱藏 
  if (strpos($str, '@')) { 
    $email_array = explode("@", $str); 
    $prevfix = (strlen($email_array[0]) < 4) ? "" : substr($str, 0, 3); //郵箱前綴 
    $count = 0; 
    $str = preg_replace('/([\d\w+_-]{0,100})@/', '***@', $str, -1, $count); 
    $rs = $prevfix . $str; 
  } else { 
    $pattern = '/(1[3458]{1}[0-9])[0-9]{4}([0-9]{4})/i'; 
    if (preg_match($pattern, $str)) { 
      $rs = preg_replace($pattern, '$1****$2', $str); // substr_replace($name,'****',3,4); 
    } else { 
      $rs = substr($str, 0, 3) . "***" . substr($str, -1); 
    } 
  } 
  return $rs; 
} 
?> 
<?php 
$account = "phpfensi.com"; 
$email = "416148489@qq.com"; 
$phone = "18005152525"; 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>演示:PHP以星號隱藏用戶名手機(jī)和郵箱</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> 
    <link rel="stylesheet" type="text/css" href="http://www.phpfensi.com /jquery/css/common.css" rel="external nofollow" /> 
    <style type="text/css"> 
    </style> 
  </head> 
  <body> 
    <div class="head"> 
      <div class="head_inner clearfix"> 
        <ul id="nav"> 
          <li><a  rel="external nofollow" rel="external nofollow" >首 頁</a></li> 
          <li><a href="http://www.phpfensi.com /templates" rel="external nofollow" >網(wǎng)站模板</a></li> 
          <li><a href="http://www.phpfensi.com /js" rel="external nofollow" >網(wǎng)頁特效</a></li> 
          <li><a href="http://www.phpfensi.com /php" rel="external nofollow" >PHP</a></li> 
          <li><a href="http://www.phpfensi.com /site" rel="external nofollow" >精選網(wǎng)址</a></li> 
        </ul> 
        <a class="logo"  rel="external nofollow" rel="external nofollow" ><img src="http://www.phpfensi.com /Public/images/logo.jpg" alt="素材火logo" /></a> 
      </div> 
    </div> 
    <div class="container"> 
      <div class="demo"> 
        <h2 class="title"><a href="http://www.phpfensi.com /js/548.html" rel="external nofollow" >教程:PHP以星號隱藏用戶名手機(jī)和郵箱</a></h2> 
        <table width="100%" class="table_parameters"> 
          <tr class="tr_head"> 
            <td>賬號</td> 
            <td>郵箱</td> 
            <td>手機(jī)</td> 
          </tr> 
          <tr> 
            <td><?php echo $account; ?></td> 
            <td><?php echo $email; ?></td> 
            <td><?php echo $phone; ?></td> 
          </tr> 
          <tr class="red"> 
            <td><?php echo hideStar($account); ?></td> 
            <td><?php echo hideStar($email); ?></td> 
            <td><?php echo hideStar($phone); ?></td> 
          </tr> 
        </table> 
      </div> 
    </div> 
  </body> 
</html> 



以上就是扣丁學(xué)堂PHP在線學(xué)習(xí)小編給大家分享的PHP使用星號替代用戶名手機(jī)和郵箱的實現(xiàn)代碼,希望對小伙伴們有所幫助,想要了解更多關(guān)于PHP開發(fā)方面問題的小伙伴可以登錄扣丁學(xué)堂官網(wǎng)咨詢??鄱W(xué)堂不僅有專業(yè)的PHP培訓(xùn)班供大家報名學(xué)習(xí),還有大量專業(yè)的老師全程授課,和緊隨時代發(fā)展不斷更新的課程體系,定能讓你學(xué)有所成。扣丁學(xué)堂PHP技術(shù)交流群:374332265。




扣丁學(xué)堂微信公眾號

【關(guān)注微信公眾號獲取更多學(xué)習(xí)資料】

 


查看更多關(guān)于“php培訓(xùn)資訊”的相關(guān)文章>>



標(biāo)簽: 扣丁學(xué)堂PHP培訓(xùn) 如何用星號替代用戶名手機(jī)和郵箱 PHP在線學(xué)習(xí) PHP培訓(xùn) PHP在線視頻 PHP基礎(chǔ)學(xué)習(xí) PHP基礎(chǔ)視頻 PHP入門視頻

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國免費咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

北京千鋒互聯(lián)科技有限公司版權(quán)所有   北京市海淀區(qū)寶盛北里西區(qū)28號中關(guān)村智誠科創(chuàng)大廈4層
京ICP備2021002079號-2   Copyright ? 2017 - 2022
返回頂部 返回頂部