Laravel 4 Response下载问题 [英] Laravel 4 Response download issue

查看:71
本文介绍了Laravel 4 Response下载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图强制下载包含一些PDF的zip文件.

I am trying to force a download of a zip file that contains a few PDFS.

return Response::download($zipperPath, NULL, array('content-type' => 'application/zip'));

这将强制下载..但是文件已损坏.如果我修复了zip,则修复了重建后的zip的问题.我不确定是否可能在标题中缺少某些内容,或者这是否与Laravel有关?

This will force the download.. however the files are corrupted. If I repair the zip it fixes the issue with the re-built zip. I am not sure if maybe I am missing something in the headers or if this is an issue with Laravel?

感谢您的帮助,谢谢.

推荐答案

$response = Response::download($file, NULL, $headers);
ob_end_clean();
return $response;

https://github.com/laravel/framework/issues/2892

这篇关于Laravel 4 Response下载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆