我试图使用header()
在while
循环中下载多个文件,但只有一个文件被下载。为什么?强制使用头文件()中的多个文件下载php
while ($row = mysql_fetch_array($sql)) {
header('Content-Type: text/x-vcard');
header('Content-Disposition: attachment; filename=' . $row['name'] . '.vcf');
}
我试图使用header()
在while
循环中下载多个文件,但只有一个文件被下载。为什么?强制使用头文件()中的多个文件下载php
while ($row = mysql_fetch_array($sql)) {
header('Content-Type: text/x-vcard');
header('Content-Disposition: attachment; filename=' . $row['name'] . '.vcf');
}
您可以一次只传输从服务器端的一个文件。典型的解决方法是:
这是不可能的。 HTTP协议不支持下载多个文件。最常见的解决方法是将文件放在一个zip存档中供客户端下载。
实际上,Chrome支持此功能。 – Dereckson
@Dereckson然后请为这个问题添加一个答案!这是非常有趣的消息! –