<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');// The PDF source is in original.pdf
readfile('original.pdf');
?> 在这里,我想把输入的文件名downloaded.pdf改成一个变量,比如说$filename,根据原文件名动态生成输入的文件名,具体的syntax应该怎么写呢我试了header('Content-Disposition: attachment; filename=$filename');不行
// We'll be outputting a PDF
header('Content-type: application/pdf');// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');// The PDF source is in original.pdf
readfile('original.pdf');
?> 在这里,我想把输入的文件名downloaded.pdf改成一个变量,比如说$filename,根据原文件名动态生成输入的文件名,具体的syntax应该怎么写呢我试了header('Content-Disposition: attachment; filename=$filename');不行
$filename你可以通過數據表,文本,或者其它任何方式獲得一個變化的值
header('Content-Disposition: attachment; filename={$filename}');