如何隐藏电子邮件地址
How can hide the email address
我有一个 table 显示一些数据钱包地址或电子邮件。
我需要什么时候是电子邮件然后像这样隐藏@之前的字母 ****@gmail.com
我的table在前面php是:
<table class="table table-striped text-center"><thead><tr>
<th scope="col">Username</th>
<th scope="col">Address</th>
</tr>
</thead>
<tbody>
<?php
foreach ($withdrawHistory as $wd) {
echo '<tr><td>' . $wd["username"] . '</td>
<td>' . $wd["wallet"] . '</td>
</tr>'; }?> </tbody></table>
有办法隐藏吗?
一种方法是使用 explode(在 foreach 循环内),然后只回显 $email。
$wallet = explode("@", $wd["wallet"]);
$email = "****@". $wallet[1];
echo $email;
如果您希望@之前的字母数量与*的数量匹配,请使用此选项。
$wallet = explode("@", $wd["wallet"]);
$y = strlen($wallet[0]);
$hidden = "";
for ($x = 1; $x <= $y; $x++) {
$hidden .= "*";
}
$email = $hidden ."@". $wallet[1];
echo $email;
<table class="table table-striped text-center"><thead><tr>
<th scope="col">Username</th>
<th scope="col">Address</th>
</tr>
</thead>
<tbody>
<?php
foreach ($withdrawHistory as $wd) {
echo '<tr><td>' . $wd["username"] . '</td>
<td>' . '****'.strstr($wd["wallet"], '@') . '</td>
</tr>'; }?> </tbody></table>
我有一个 table 显示一些数据钱包地址或电子邮件。
我需要什么时候是电子邮件然后像这样隐藏@之前的字母 ****@gmail.com
我的table在前面php是:
<table class="table table-striped text-center"><thead><tr>
<th scope="col">Username</th>
<th scope="col">Address</th>
</tr>
</thead>
<tbody>
<?php
foreach ($withdrawHistory as $wd) {
echo '<tr><td>' . $wd["username"] . '</td>
<td>' . $wd["wallet"] . '</td>
</tr>'; }?> </tbody></table>
有办法隐藏吗?
一种方法是使用 explode(在 foreach 循环内),然后只回显 $email。
$wallet = explode("@", $wd["wallet"]);
$email = "****@". $wallet[1];
echo $email;
如果您希望@之前的字母数量与*的数量匹配,请使用此选项。
$wallet = explode("@", $wd["wallet"]);
$y = strlen($wallet[0]);
$hidden = "";
for ($x = 1; $x <= $y; $x++) {
$hidden .= "*";
}
$email = $hidden ."@". $wallet[1];
echo $email;
<table class="table table-striped text-center"><thead><tr>
<th scope="col">Username</th>
<th scope="col">Address</th>
</tr>
</thead>
<tbody>
<?php
foreach ($withdrawHistory as $wd) {
echo '<tr><td>' . $wd["username"] . '</td>
<td>' . '****'.strstr($wd["wallet"], '@') . '</td>
</tr>'; }?> </tbody></table>