作者 lyh

GX生成白帽报表脚本

@@ -57,11 +57,15 @@ class UpdateProjectTdk extends Command @@ -57,11 +57,15 @@ class UpdateProjectTdk extends Command
57 $noticeLogModel->edit(['status'=>$noticeLogModel::STATUS_SUCCESS],['id'=>$task_id]); 57 $noticeLogModel->edit(['status'=>$noticeLogModel::STATUS_SUCCESS],['id'=>$task_id]);
58 continue; 58 continue;
59 } 59 }
  60 + // 下载到 Laravel storage 的临时路径
  61 + $tempPath = storage_path('app/temp_url.xlsx');
  62 + file_put_contents($tempPath, file_get_contents($url));
60 // 载入 Excel 63 // 载入 Excel
61 // try { 64 // try {
62 - $spreadsheet = IOFactory::load($url); 65 + $spreadsheet = IOFactory::load($tempPath);
63 $sheet = $spreadsheet->getActiveSheet(); 66 $sheet = $spreadsheet->getActiveSheet();
64 $rows = $sheet->toArray(); 67 $rows = $sheet->toArray();
  68 + unlink($tempPath);
65 dd($rows); 69 dd($rows);
66 // }catch (\Exception $e){ 70 // }catch (\Exception $e){
67 // echo '文件打不开'.PHP_EOL; 71 // echo '文件打不开'.PHP_EOL;