php - 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 加载它。太感谢了。希望有人帮助我。
解决方案
它实际写入文件的部分在哪里
例如,这是 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();
推荐阅读
- javascript - 如何在 ASP.NET MVC 5 中将我的 viewbag 内容(一个巨大的表)从视图传递到控制器
- css - React - 始终选择媒体查询 CSS 样式
- hazelcast - Hazelcast jet 仅在 1 个节点上运行
- android - 无论如何从链接中提取文件?
- git - 将两个共享文件的 git repos 合并/变基为一个
- c# - 抛出尝试通过代码检查互联网连接时操作超时错误,在另一台电脑上工作正常
- c# - IIS 无法运行 Windows 应用程序 - .Net Core 2
- lua - 重力无法正常工作
- d3.js - C3 标题左对齐
- python - 如何在 Python 中创建带换行符的字符串?