|
|
@@ -656,9 +656,15 @@ class PackagingCountDocument extends Api
|
|
|
}
|
|
|
}
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
+// 将 Excel 文件转换为二进制数据
|
|
|
+ $excelData = $writer->writeToString();
|
|
|
+
|
|
|
+// 返回 Excel 数据给前端
|
|
|
+ $this->success('成功', $excelData);
|
|
|
|
|
|
header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
|
|
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
|
+
|
|
|
$writer->save("php://output"); //表示在$path路径下面生成demo.xlsx文件
|
|
|
|
|
|
}
|