Php 某些单元格未显示在tcpdf中

Php 某些单元格未显示在tcpdf中,php,dynamic,html-table,tcpdf,Php,Dynamic,Html Table,Tcpdf,我正在使用tcpdf创建动态表,但没有正确地获取表。我只得到了每行的第一个单元格,其他单元格将不显示,而且表格边框也消失了。我怎样才能修好它 $pdf->SetFont('helvetica', 'B', 20); $pdf->AddPage(); $pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('helvetica', '',

我正在使用tcpdf创建动态表,但没有正确地获取表。我只得到了每行的第一个单元格,其他单元格将不显示,而且表格边框也消失了。我怎样才能修好它

$pdf->SetFont('helvetica', 'B', 20);

$pdf->AddPage();

$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);

$pdf->SetFont('helvetica', '', 8);
$pdf->setPageMark();

$pdfArray = array();
$str2 = "<table cellspacing='1' cellpadding='1' border='1'><tr><td colspan='6'>".$br1."  ". $sem1."</td></tr>";

$i=1;
$str2 .="<tr>";
while($i<=42)
{
$str2 .="<td>"."  ".$i."</td>";
if($i%6==0)
  $str2 .="</tr><tr>";
$i++;
}
$str2 .= "</tr></table>";

array_push($pdfArray, $str2);
$table = implode(" ",$pdfArray);
$tbl100 = <<<EOD
$table
EOD;

$pdf->writeHTML($str2, true, false, false, false, '');
但我想要像这样的输出

 1
 7
 13
 19
 25
 31
1 2 3 4 5 6
7 8 9 10 11 12
13 14 ...
25 26 ...
31 32 ...
if($i%6==0)
不匹配,但您也应该检查
while($f1=mysql\u fetch\u row($res))
表达式。(
mysql\u fetch\u array()
推荐)

编辑:

我在TCPDF源中找到了一条评论:

NOTE: all the HTML attributes must be enclosed in double-quote.
所以这应该是正确的:

$str2 = '<table cellspacing="10" cellpadding="1" border="10"><tr><td colspan="7">'.$br1.'  '. $sem1.'</td></tr>';
$str2='.$br1'.'$sem1";;

没有帮助。我正在装箱时间表,其中第一列是per-1、per-2等,还有六个周期,这就是为什么colspan=7和$i%6==0echo$str2工作得很好,但我想将$str2转换成pdf。这就是我使用tcpdf的原因。HTML代码工作得很好。嗯,TCPDF不是浏览器。:)Stocki现在我编辑代码,粘贴它并解决了这个问题。提前谢谢。