相关疑难解决方法(0)

为什么在Laravel中不能轻松下载大文件?

我的文件(126 MB大小,.exe)给了我一些问题.

我正在使用标准的laravel下载方法.

我尝试增加内存,但它仍然说我的内存不足,或者我下载了0 KB大小的文件.

该文档没有提到任何有关大文件大小的内容.

我的代码是

ini_set("memory_limit","-1"); // Trying to see if this works
return Response::download($full_path);
Run Code Online (Sandbox Code Playgroud)

我做错了什么?

- 编辑 -

继续Phill Sparks评论,这就是我所拥有的并且它的工作原理.它是Phill的组合加上一些来自php.net的组合.不确定是否有遗失的东西?

public static function big_download($path, $name = null, array $headers = array())
{
    if (is_null($name)) $name = basename($path);

    // Prepare the headers
    $headers = array_merge(array(
        'Content-Description'       => 'File Transfer',
        'Content-Type'              => File::mime(File::extension($path)),
        'Content-Transfer-Encoding' => 'binary',
        'Expires'                   => 0,
        'Cache-Control'             => 'must-revalidate, post-check=0, pre-check=0',
        'Pragma'                    => 'public',
        'Content-Length'            => File::size($path),
    ), $headers);

    $response = new Response('', 200, …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-3

7
推荐指数
2
解决办法
9476
查看次数

标签 统计

laravel ×1

laravel-3 ×1

php ×1