我已經創建了一個頁面,您可以在「textarea」中寫入文本,然後當您單擊下載時,將該文件下載爲.txt文件。我對其他擴展做了同樣的事情,並且工作正常。但它不會與.PDF一起使用,我沒有讀過任何東西。這裏是我用於.PDF下載的片段:PHP標頭下載PDF
<?php
if($fileFormat == ".pdf"){
$content = $_POST['text'];
$name = stripslashes($_POST['name']);
$nameAndExt = $name.".pdf";
print strip_tags($content);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.$nameAndExt.'"');
header('Content-Transfer-Encoding: binary ');
}
?>
我很感謝任何answear,謝謝!
我認爲這隻適用於修改後的標題。你需要一個像這樣的html2pdf轉換器插件:http://sourceforge.net/projects/html2fpdf/ – GoE
好的,我會查找它,謝謝! –