这是我下载文件的代码:
假设我想下载pdf,所以
$file = 'Dev-TipsTricks.pdf';
$mime_type = 'application/pdf';
header("Content-type: $mime_type");
header("Content-disposition: attachment; filename=$file");
ob_clean();
flush();
readfile('wp-content/uploads/'.$file);
exit;
但是下载后当我尝试打开它时说: 我也尝试过 docx & 再次:
虽然文件内容是正确的并且在上传文件夹中它是正确打开的,但我也尝试了我的gif 图像代码,但它说: