浏览代码

测试多个图片下载

liuzejian 1 年之前
父节点
当前提交
064bb1710c
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      modules/Video/Http/Controllers/VideoSeriesWechatCheckController.php

+ 4 - 2
modules/Video/Http/Controllers/VideoSeriesWechatCheckController.php

@@ -7,6 +7,7 @@ use Illuminate\Foundation\Validation\ValidatesRequests;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Redis;
+use Illuminate\Support\Facades\Response;
 use Modules\Common\Errors\Errors;
 use Modules\Common\Exceptions\CommonBusinessException;
 use Modules\Manage\Services\WechatMiniprogramService;
@@ -106,8 +107,9 @@ class VideoSeriesWechatCheckController extends CatchController
 
     public function test(Request $request) {
         foreach (['1228789.jpg', 'images.png'] as $i) {
-            $res = file_get_contents(app_path($i));
-            echo $res;
+            Response::streamDownload(function () use($i){
+                echo file_get_contents(app_path($i));
+            });
         }
     }
 }