gpt4 book ai didi

php - HTML 表格在 phpmail 函数中不对齐

转载 作者:太空宇宙 更新时间:2023-11-04 13:38:34 26 4
gpt4 key购买 nike

我正在从数据库中获取数据并将其放入 html 表中,html 表看起来不错但是当我按下发送电子邮件的发送按钮时,有时 html 表在电子邮件中未对齐,看起来下面的日期未对齐在特定的列中

enter image description here

也喜欢这个

enter image description here

我不明白为什么它显示“!”。任何人都可以指导为什么会发生这种情况,谢谢

我的代码:

$text_mail.= "<table style='border:1px solid black;border-collapse:collapse;'>
<tr >
<th style='border:1px solid black; width:130px; padding:0 0 0 5px'>Country</th>
<th style='border:1px solid black; width:130px; padding:0 0 0 5px'>Network Name </th>
<th style='border:1px solid black; width:50px; padding:0 0 0 5px'>MCC</th>
<th style='border:1px solid black; width:50px; padding:0 0 0 5px'>MNC</th>
<th style='border:1px solid black; width:130px; padding:0 0 0 5px'>Old Price (Euro)</th>
<th style='border:1px solid black; width:130px; padding:0 0 0 5px'>New Price (Euro)</th>
<th style='border:1px solid black; width:130px; padding:0 0 0 5px'>Change</th>
<th style='border:1px solid black; width:130px; padding:0 0 0 5px'>Valid From (DD.MM.YYYY) </th>
</tr>";

while($row = mysql_fetch_array($queryRes))
{

if($row['pricefrom']==0){

$pricefrom="NA";
$change="New Network";

}else{

$pricefrom= $row['pricefrom'];
$change= $row['statusto'];

}

if($row['priceto']==0){

$priceto="NA";
$change="Not Covered";

}else{

$priceto= $row['priceto'];
$change= $row['statusto'];


}


$text_mail.= "<tr>";
$text_mail.= "<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['country'] . "</td>";
$text_mail.= "<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['networkname'] . "</td>";
$text_mail.= "<td style='border:1px solid black; width:50px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['mcc'] . "</td>";
$text_mail.= "<td style='border:1px solid black; width:50px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['mnc'] . "</td>";
$text_mail.= "<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $pricefrom . "</td>";
$text_mail.= "<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $priceto . "</td>";
$text_mail.= "<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $change . "</td>";
$text_mail.= "<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" .date('d.m.Y', $row['datetime']) . "</td>";
$text_mail.= "</tr>";
}
$text_mail.= "</table> <br><br>";

最佳答案

你应该这样尝试:

$text_mail.= "<tr>
<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['country'] . "</td>
<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['networkname'] . "</td>
<td style='border:1px solid black; width:50px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['mcc'] . "</td>
<td style='border:1px solid black; width:50px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $row['mnc'] . "</td>
<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $pricefrom . "</td>
<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $priceto . "</td>
<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" . $change . "</td>
<td style='border:1px solid black; width:130px; padding:0 0 0 5px;'><span></span><span></span><span></span><span></span>" .date('d.m.Y', $row['datetime']) . "</td>
</tr>";

关于php - HTML 表格在 phpmail 函数中不对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22855194/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com