代码之家  ›  专栏  ›  技术社区  ›  Good Day

无法打开/var/folders/n/laravel-excel.maatwebsite

  •  0
  • Good Day  · 技术社区  · 6 年前

    我想使用laravel-excel.maatwebsitelibrary创建下载excel函数。我的代码如下:

    return Excel::download(new PembukuanExport, 'pembukuan.xlsx');
    

    但当我运行它时,它给了我这样的错误

    无法打开/var/folders/n_u/xh_10hm50dvbwg23cfq_kw3h0000gn/T/laravel-excel-DMBN3reNUrSiamYT进行写入。

    enter image description here

    我的笔记本电脑是macbook,一直在搜索,但找不到正确的答案

    1 回复  |  直到 6 年前
        1
  •  1
  •   Good Day    6 年前

    我通过改变解决了这个问题 User & Group 在“httpd.conf。

    1. 正常开放 httpd.config .
    2. 搜索关键字“用户或组”并更改它。
    3. User your_mac_user 并填写 Group staff
        2
  •  0
  •   Nitish Kumar    6 年前

    回答这个问题可能太晚了,但我想您需要配置 excel.php 配置文件。

    发布excel配置文件:

    php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"
    

    现在在 config/excel.php 需要进行配置的文件:

    'temporary_files' => [
    
        /*
        |--------------------------------------------------------------------------
        | Local Temporary Path
        |--------------------------------------------------------------------------
        |
        | When exporting and importing files, we use a temporary file, before
        | storing reading or downloading. Here you can customize that path.
        |
        */
        'local_path'  => storage_path(),
    
        /*
        |--------------------------------------------------------------------------
        | Remote Temporary Disk
        |--------------------------------------------------------------------------
        |
        | When dealing with a multi server setup with queues in which you
        | cannot rely on having a shared local temporary path, you might
        | want to store the temporary file on a shared disk. During the
        | queue executing, we'll retrieve the temporary file from that
        | location instead. When left to null, it will always use
        | the local path. This setting only has effect when using
        | in conjunction with queued imports and exports.
        |
        */
        'remote_disk' => null,
    
    ],
    

    这会将临时文件夹设置为具有执行权限的存储路径。希望这对别人有帮助。

    推荐文章