12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\index\controller;
-
-
-
- use app\common\basics\IndexBase;
- use app\common\cache\ExportCache;
-
-
- class Download extends IndexBase
- {
-
- public $like_not_need_login = ['export'];
-
- public function export()
- {
-
- $fileKey = request()->get('file');
-
-
- $exportCache = new ExportCache($fileKey);
- $fileInfo = $exportCache->getFile($fileKey);
-
- if (empty($fileInfo)) {
- abort(404, '下载文件不存在');
- }
-
-
- $exportCache->del($fileKey);
-
- return download($fileInfo['src'] . $fileInfo['name'], $fileInfo['name']);
- }
-
-
-
- }
|