Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
实际上,我的网站上有一些下载链接,例如“http://www.example.com/somesong.mp3”。现在,当用户单击此链接时,他们会得到 somesong.mp3,但我想在下载之前对其进行更改。我发现许多脚本使之成为可能,但没有得到完全正确的脚本。因为我希望当用户点击下载链接时,文件下载应该在点击我想要使用的新文件名后立即开始。
但是在我下载的所有脚本中,首先 php 处理开始几分钟(我认为这取决于文件大小)然后重命名它。有没有办法用新文件名直接强制文件头中的文件。
谢谢。
尝试这个
header("Content-Disposition: attachment; filename=whatever you want");