我在PHP工作,我想知道这是可能的下载“两个不同的文件”在同一次点击?我尝试了以下代码
$pth = file_get_contents(base_url()."path/to/the/file.pdf");
$nme = "sample_file.pdf";
$pth2 = file_get_contents(base_url()."path/to/the/file2.pdf");
$nme2 = "sample_file2.pdf";
force_download($nme, $pth);
force_download($nme2, $pth2);
1条答案
按热度按时间pvcm50d11#
不,在服务器端(不管是什么语言),你不能在同一个请求中触发两个不同的下载。你可以通过javascript来实现,如下所示: