首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用mikehaertl/phpwkhtmltopdf

使用mikehaertl/phpwkhtmltopdf
EN

Stack Overflow用户
提问于 2019-01-25 17:55:54
回答 1查看 298关注 0票数 0

错误是,我不能使用循环前端或此包mikehaertl/phpwkhtmltopdf生成PDF。

代码语言:javascript
复制
 $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动态添加日期。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-25 18:00:49

你为什么不试试另一种方法:

代码语言:javascript
复制
// 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);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54370528

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档