PHP帮助 - MIME代码?

时间:2012-03-05 12:10:55

标签: php mime

我想使用MIME代码下载完整的网页。我正在使用

header("Content-type:application/msword");
header("Content-Disposition:attachment; Filename=$profile_id.doc");

在MS Word中下载网页,我正在尝试:

header("Content-type:application/pdf");
header("Content-Disposition:attachment; Filename=$profile_id.pdf");

以PDF格式下载网页,但PDF格式无效。请告诉我怎么做...谢谢:)

我认为此代码现已弃用。请让我知道这个

的替代代码

1 个答案:

答案 0 :(得分:0)

尝试:


header('Content-Type:application/pdf');
header('Content-Disposition:attachment; filename="'.$profile_id.'.pdf"');

<强>编辑: 试试,比如:


$file = $profile_id.".pdf";
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Type: application/octetstream');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header('Content-Disposition:attachment; filename="'.$profile_id.'.pdf"');