如果文件名名称中有空格,如何设置正确的标题?
我试过
header( "Content-Disposition: attachment; filename=a fielename with spaces.txt");
但是只给出了建议的fielname“a”并切断了其余部分。
答案 0 :(得分:19)
$file_name = 'a fielename with spaces.txt';
header("Content-disposition: attachment; filename=\"".$file_name."\"");
答案 1 :(得分:4)
header( 'Content-Disposition: attachment; filename="a fielename with spaces.txt"');