header('Content-Type', $type); }); //获取考勤的图片 Route::get('/kq/image/{filename}', function ($filename) { $last_dir = explode('_',$filename)[0]; $path = storage_path('app/kq/'.date('Ymd',$last_dir).'/' . $filename); $path = $path.'.jpg'; if (!File::exists($path)) { abort(404); } $file = File::get($path); $type = File::mimeType($path); return response($file, 200)->header('Content-Type', $type); });