如何在标头中传递多个文件扩展名参数



我有不同扩展名的文件,那么我如何在一个头中定义多个扩展名。例如

 header("Content-type: application/xml"); 
 header("Content-type: application/txt");

有没有任何可能性,在一个单独的标题中定义这样的

 header("Content-type: application/xml txt"); 

提前感谢您的建议

如果您想下载任何类型的文件,只需使用application/octet-stream.

header('Content-Type: application/octet-stream');

//例如,这将下载任何类型的文件

 header('Content-Description: File Transfer');
 header('Content-Type: application/octet-stream');
 header('Content-Disposition: attachment; filename="' . basename($file) . '"');
 header('Expires: 0');
 header('Cache-Control: must-revalidate');
 header('Pragma: public');
 header('Content-Length: ' . filesize($file));
 readfile($file);

最新更新