3

如果文件名中应包含空格,如何设置正确的标题?

我试过了

header( "Content-Disposition: attachment; filename=a fielename with spaces.txt");

但这只给出了建议的字段名“a”并切断了其余部分。

4

2 回答 2

22
$file_name = 'a fielename with spaces.txt';
header("Content-disposition: attachment; filename=\"".$file_name."\""); 
于 2013-06-21T09:25:56.383 回答
4
header( 'Content-Disposition: attachment; filename="a fielename with spaces.txt"');
于 2013-06-21T09:20:58.267 回答