w3schools上的示例2 显示了您要实现的目标。
<?phpheader("Content-type:application/pdf");// It will be called downloaded.pdfheader("Content-Disposition:attachment;filename='downloaded.pdf'");// The PDF source is in original.pdfreadfile("original.pdf");?>
还请记住,
重要的是要注意必须在发送任何实际输出之前调用header()(在PHP 4和更高版本中,可以使用输出缓冲来解决此问题)



