From 1096d26f140d3b87d12d6264fc22c621dd9de875 Mon Sep 17 00:00:00 2001 From: zhang zhuo Date: Fri, 19 Dec 2025 11:48:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/Excel.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Utils/Excel.php b/app/Utils/Excel.php index 09a4e86..294409c 100644 --- a/app/Utils/Excel.php +++ b/app/Utils/Excel.php @@ -4,6 +4,7 @@ namespace App\Utils; use Exception; use PhpOffice\PhpSpreadsheet\IOFactory; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Spreadsheet; use function Hyperf\Config\config; @@ -19,7 +20,7 @@ class Excel $file = BASE_PATH . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR . $file; if (!file_exists($file)) return false; // 显式使用 Xlsx 读取器并配置兼容选项 - $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); + $reader = new Xlsx(); // 关键配置:跳过样式/公式等兼容性陷阱 $reader->setReadDataOnly(true); // 只读数据,忽略公式 $reader->setReadEmptyCells(false); // 跳过空单元格处理