Browse Source

下载文件

shish 4 years ago
parent
commit
9a9760dc8b
1 changed files with 13 additions and 0 deletions
  1. 13 0
      app-ghs/controllers/CsController.php

+ 13 - 0
app-ghs/controllers/CsController.php

@@ -156,4 +156,17 @@ class CsController extends PublicController
         exit;
     }
 
+    //下载文件 shish 20210922
+    public function actionExcel()
+    {
+        $filePath = './priceTable/12715/09-22.xls';
+        $file=fopen($filePath,"r");
+        header("Content-Type: application/octet-stream");
+        header("Accept-Ranges: bytes");
+        header("Accept-Length: ".filesize($filePath));
+        header("Content-Disposition: attachment; filename=2.xls");
+        echo fread($file,filesize($filePath));
+        fclose($file);
+    }
+
 }