可以说我有以下文件:如何从php文件“制作”PDF文件?
layout.php中
<?php
session_start();
?>
<table width="700" border="1" cellspacing="0" cellpadding="0">
<tr>
<th>Id</th>
<th>Nombre</td>
</tr>
<tr>
<td><?php echo $_SESSION['id']; ?></td>
<td><?php echo $_SESSION['nombre']; ?></td>
</tr>
</table>
有没有一种方法,我可以下载该文件,将输出文件就像你看到它在浏览器中的PDF?
我试过,但它没有工作:
<?php
session_start();
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=info_user.pdf");
readfile('layout.php');
?>
PDF文件是在一个特定的格式,你不能只是做一个这样的。您需要使用像[dompdf](https://code.google.com/p/dompdf/)或[FPDF](http://www.fpdf.org/)这样的库。 – 2013-02-26 17:01:18
不,没有办法这样做,因为你不能只发送'Content-Type:audio/mpeg3'并得到一首歌。 – 2013-02-26 17:01:52