下载后自动打开设置[PHP]

时间:2014-06-18 15:35:55

标签: php google-chrome automation

如果您访问https://www.google.com/chrome/browser/#eula下载Google Chrome,则会在点击“接受”后自动启动设置文件。安装按钮。 我的问题是,如果在下载完成后自动下载就像Chrome一样,我可以向用户的电脑打开文件吗?

先谢谢

1 个答案:

答案 0 :(得分:0)

只需将正确的标题设置为您的文件即可。 例如,如果您的文件是pdf:

header("Content-Type: application/vnd.pdf");
header("Content-Disposition: attachment;filename=\"my_document.pdf\"");
header("Cache-Control: max-age=0");
//... code for generating the pdf...

标题必须设置在php页面的开头

相关问题