Laravel 5 使用mikehaertl/phpwkhtmltpdf

Laravel 5 使用mikehaertl/phpwkhtmltpdf,laravel-5,Laravel 5,错误是我不能使用循环 foreach或for与此包一起使用mikehaertl/phpwkhtmltopdf生成PDF $pdf->addPage( '<html> <HEAD> <TITLE>Acta de Recepcion</TITLE> <link rel="stylesheet" href=

错误是我不能使用循环 foreach或for与此包一起使用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>');
$pdf->addPage(
'
退学学报
');

我需要使用foreach动态添加日期

为什么不尝试另一种方式:

// 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);
//构建内容
$content='1
退学学报
';
//添加日期
foreach(到期日为$d){
$content.=$d->placa;
}
//完成内容
$content.='
';
//添加页面
$pdf->addPage($content);