我不知道为什么它不起作用。我使用 while 循环生成了多个带有 ezpdf 类的 pdf,并且只创建了 1 个 pdf。我也试过'for循环'但还是一样。我应该怎么做才能获得多个pdf?
include ('class.ezpdf.php');
$limit = 1;
while($limit < 5){
$colw = array( 80 , 40, 220, 80, 40 );//column widths
$rows = array(
array('company','size','desc','cost','instock'),
array("WD", "80GB","WD800AAJS SATA2 7200rpm 8mb" ,"$36.90","Y"),
);
//x is 0-600, y is 0-780 (origin is at bottom left corner)
$pdf =& new Cezpdf('LETTER');
$total=0;
$curr_x=80;
$curr_y=600;
foreach($rows as $r)
{
$xoffset = $curr_x;
foreach($r as $i=>$data)
{
$pdf->setColor(0/255,0/255,0/255);
$pdf->addText( $xoffset, $curr_y , 10, $data );
$xoffset+=$colw[$i];
}
$curr_y-=20;
}
define('MY_FILENAME', 'testDoc'.$limit.'.pdf');
$pdfcode = $pdf->ezOutput();
$fp = fopen(MY_FILENAME, 'wb');
fwrite($fp, $pdfcode);
fclose($fp);
}