我使用Laravel的存储门面下载PDF文件,我能够上传PDF到S3,我也能得到()的内容,但我不能显示或将其下载到最终用户作为实际的pdf文件。它看起来像原始数据。这里是代码:Laravel 5.1 - 如何从S3斗
$file = Storage::disk($storageLocation)->get($urlToPDF);
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename='file.pdf'");
echo $file;
这怎么办?我检查了几篇文章(和SO),但他们都没有为我工作。
为什么这个downvoted即使它被接受? –
这是一个不好的解决方案 –