gpt4 book ai didi

php - 如何暂时跳过一行

转载 作者:行者123 更新时间:2023-11-29 09:44:10 26 4
gpt4 key购买 nike

我正在尝试使用函数 FPDF 将 php 转换为 pdf,但我在数据库上进行了选择,我希望在 PDF 中包含此选择的所有元素:

$query="select organisme,id from client";
$resultats=$db->query($query);
$pdf=new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',12);
$pdf->Cell(20,6,'ID',1,0,'C',100);
$pdf->Cell(70,6,'mes organismes',1,0,'C',1);
$pdf->SetFont('Arial','',10);

while ($row = $resultats->fetch(PDO::FETCH_ASSOC))
{
$pdf->Cell(20,6,utf8_decode($row['id']),1,0,'C',1);
$pdf->Cell(70,6,$row['organisme'],1,0,'C',1);
}

$pdf->Output();
?>

但问题是我得到了 ID 和有机体,但我有一个问题:

enter image description here

我想知道如何跳线进入所有新的 ID 和有机体

谢谢

最佳答案

FPDF 的 Ln() 函数执行换行。

$pdf->Ln();

将此行添加到您的 $pdf->Cell() 函数调用下方,无论是在标题行还是在 while 循环内。

关于php - 如何暂时跳过一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56019999/

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