首页 > 解决方案 > Mpdf加载一次然后不起作用

问题描述

我目前正在尝试 Mpdf,使用 composer 安装它并创建了一个简单的代码。这里是

<?php 
require_once 'vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML("<h1 style='color:red'>Hello world!</h1>");
$mpdf->Output();
?>

它成功加载一次然后它不会加载更多。我正在通过 XAMPP 加载它。太感谢了。希望有人帮助我。

标签: phpmpdf

解决方案


它实际写入文件的部分在哪里

例如,这是 html

$html = '<table width="60%" cellspacing="0">
            <thead>
                <tr>
                    <th>Empid</th>
                    <th>Name</th>
                    <th>Salary</th>
                    <th>Age</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                   <td>1</td>
                   <td>Tiger Nixon</td>
                   <td>320800</td>
                   <td>61</td>
                </tr>
            </tbody>
        </table>';

//save the file put which location you need folder/filname
$mpdf->Output("phpflow.pdf", 'F');


//out put in browser below output function
$mpdf->Output();

推荐阅读