FPDF在一个单元格中设置2个连续值

问题描述

我只需要找出如何在 FPDF 中从 MysqL 数据库中设置 2 个值。这些值将是连续的,它们之间有一个“破折号”。这是我想要做一个例子。

$pdf->Cell(110,7,$address1 ' - ',$address2);

解决方法

您使用的是逗号,但应该使用点“.”。 FPF 将这些视为用逗号分隔的不同参数。

// this will work (note the dots instead of the comma)
$pdf->Cell(110,7,$address1 . ' - ' . $address2);

// I prefer this: it is easier to read
$fullAddress = $address1 . ' - ' . $address2;
$pdf->Cell(110,$fullAddress);