我不知道为什么,但我的pdf批次不工作,现在我有这个错误。问题来自while循环中的类。
谢谢
注意:OM\Registry.php::set- Order已经注册,没有被迫在/home/www/shop/include/OM/Registry.php第33行中被替换,致命错误: Uncaught : FPDF错误:一些数据已经输出,无法将PDF文件发送到/home/www/精品/ext/FPDF/fpdf.php:271堆栈跟踪:#0 /home/www/精品/ext/FPDF/fpdf.php(1063):FPDF->错误(“一些数据有一个.‘) #1 /home/www/精品/ext/FPDF/fpdf.php(999):FPDF->_ /home/www/boutique/admin/invoice_batch.php(570):输出() #2 FPDF->输出#3 {主)在第271行上抛入/home/www/精品/ext/fpdf/fpdf.php。
此错误与此元素有关。
// Classe pdf.php
$pdf = new \FPDF();
// $pdf->SetWidths(array(30,50,30,40));
while ($QordersInfo->fetch()) {
Registry::set('Order', new OrderAdmin($QordersInfo->valueInt('orders_id')));
$order = Registry::get('Order');
...
..
}
// PDF's created no
// output the file
$pdf->Output();如果我写这个,它“工作得很好”,但它只显示一个发票。
// Classe pdf.php
$pdf = new \FPDF();
// $pdf->SetWidths(array(30,50,30,40));
while ($QordersInfo->fetch()) {
Registry::set('Order', new OrderAdmin($QordersInfo->valueInt('orders_id')));
$order = Registry::get('Order');
.....
// output the file
$pdf->Output();
}发布于 2017-04-20 04:14:20
在不知道Registry::set()做什么的情况下很难跟踪这个问题,但是这个函数的第一个参数应该是唯一的键。在您的代码中,在循环的每个迭代中,键始终是'Order'。第一次迭代将很好,但是在第二次迭代中,它将生成输出,为您提供一个已经有一个带有该键的Registry的Notice。
$pdf->Output()函数检查您的PHP代码中是否已经产生了任何输出。因为Notice被发送到输出,所以FPDF无法开始呈现并生成FPDF错误以让您知道。
或者使用唯一的键(可能是订单的ID?)或者强制注册表条目在每次迭代中被替换。如果这不能让您再次走上正轨,那么就发布Registry代码,这样我们就可以深入研究这个问题了。
https://stackoverflow.com/questions/42321085
复制相似问题