From 573e4234ffb9bb9ad54455eef3696f70dbe32c83 Mon Sep 17 00:00:00 2001 From: xieyongfa <215005377@qq.com> Date: Mon, 7 Oct 2024 09:51:42 +0800 Subject: [PATCH] Update File.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化文件下载在不同浏览器中的兼容性 --- src/think/response/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/think/response/File.php b/src/think/response/File.php index e8af6fdfa5..fbf779d759 100644 --- a/src/think/response/File.php +++ b/src/think/response/File.php @@ -66,7 +66,7 @@ protected function output($data) $this->header['Pragma'] = 'public'; $this->header['Content-Type'] = $mimeType ?: 'application/octet-stream'; $this->header['Cache-control'] = 'max-age=' . $this->expire; - $this->header['Content-Disposition'] = ($this->force ? 'attachment; ' : '') . "filename* = UTF-8''{$name}"; + $this->header['Content-Disposition'] = ($this->force ? 'attachment; ' : '') . 'filename="' . $name . '";' . "filename* = UTF-8''{$name}"; $this->header['Content-Length'] = $size; $this->header['Content-Transfer-Encoding'] = 'binary'; $this->header['Expires'] = gmdate("D, d M Y H:i:s", time() + $this->expire) . ' GMT';