我试图强制用户下载文件。为此,我的脚本是:
$file = "file\this.zip";
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Type: application/zip"); //This is what I need
header("Content-Transfer-Encoding: binary");
readfile($file);
我要上传的文件不是 .zip,所以我想知道我将在 $file 中收到的图像的内容类型。如何做到这一点