0
<?php
include ('mpdf/mpdf.php');
$mpdf = new mpdf;
ob_start();
?>
<html>
<head></head>
<body>
My various content with table, dropdown menu and 2 include files.
</body>
</html>
<?php
$html = ob_get_contents();
ob_end_clean();
$mpdf->Output();
exit;
?>
想知道为什么这个函数不起作用,只会输出空的pdf文件。我尝试了很多方法,但它不起作用。我把这个函数放在我的代码的开头,但它总是输出一个空文件。如何将HTML页面转换为PHP中的PHP
您缓冲到变量$ html和稍后并没有使用它。不知何故,你必须把它交给$ mpdf对象。但既然你没有告诉你,你正在使用哪个库房,没有人能够帮助你。检查你的libaries excamples。 – Daniel
如何通过阅读'mpdf'图书馆的文档可以很容易回答的问题得到upvotes? @Daniel是对的,你需要找到你可以传递'$ html'的mpdf方法 – Terminus