
$html="<html><head><title> Etiquettes </title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<style>
</style>
</head>
<body>";
$html.="<table>";
foreach($repas_pdj as $pdj)
{
$html.="<tr>";
$html.="<td style='width:60mm;height:30mm;border:solid 1px blue;'>".$pdj->id."</td>";
$html.="<td style='width:60mm;height:30mm;border:solid 1px blue;'>".$pdj->id."</td>";
$html.="<td style='width:60mm;height:30mm;border:solid 1px blue;'>".$pdj->id."</td>";
$html.="</tr>";
// $html.="<span class='etq'>".$pdj->id."</span>";
}
$html.="</table>";
$html.="</body></html>";
嘿朋友們,如果有人知道我如何增加每個。**我想得到:
- 7313 - 7314 - 7315
- 7316 -7317 ....**
(我正在使用 dompdf laravel) (我已經嘗試只使用 1 in 并且我使用 (display:inline;) for 但這不適用于 dompdf 所以我正在嘗試這個解決方案
uj5u.com熱心網友回復:
如果您想要每個物件/id <td>,只需在每個<td>回圈中放置一個并放置<tr>on 條件
$tdNumber = 0;
foreach($repas_pdj as $pdj) {
$tdNumber ;
if ($tdNumber == 1) {
$html.="<tr>";
}
$html.="<td style='width:60mm;height:30mm;border:solid 1px blue;'>".$pdj->id."</td>";
if ($tdNumber == 3) {
$html.="</tr>";
$tdNumber = 0;
}
}
//this is to correctly close the table
if ($tdNumber != 0) {
for ($i=$tdNumber; $i<3; $i ) {
$html.="<td style='width:60mm;height:30mm;border:solid 1px blue;'></td>";
}
$html.="</tr>";
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/344433.html
上一篇:如何解決這個錯誤引數1傳遞給Illuminate\Database\Grammar::parameterize()mustbeofthetypearray,stringgiven
