错误是我不能使用循环 foreach或与此包一起使用mikehaertl / phpwkhtmltopdf生成PDF
$pdf->addPage(
'<html>
<HEAD>
<TITLE>Acta de Recepcion</TITLE>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
</HEAD>
<body>
<?php
@foreach ($due as $d)
{{$d->placa}}
@endforeach
?>
</body>
</html>');
我需要使用foreach动态添加日期
答案 0 :(得分:0)
为什么不尝试其他方式:
// build the content
$content = '<html>
<HEAD>
<TITLE>Acta de Recepcion</TITLE>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
</HEAD>
<body>';
// add the dates
foreach ($due as $d) {
$content .= $d->placa;
}
// complete the content
$content .= '</body>
</html>';
// add the page
$pdf->addPage($content);