我有一个表格,显示了一些数据钱包地址或电子邮件。
我需要什么时候发送电子邮件然后像这样隐藏@之前的字母****@gmail.com
我在前端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>
有隐藏的方法吗?
答案 0 :(得分:0)
一种方法是使用explode(在foreach循环内),然后使用echo $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;
答案 1 :(得分:0)
<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>