Goo*_*Day 0 laravel laravel-excel maatwebsite-excel
我想使用 laravel-excel.maatwebsitelibrary 创建下载 excel 功能。我的代码如下:
return Excel::download(new PembukuanExport, 'pembukuan.xlsx');
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时,它给了我这样的错误
无法打开 /var/folders/n_/xh_10hm50dvbwg23cfq_kw3h0000gn/T/laravel-excel-DMBN3reNUrSiamYT 进行写入。
我的笔记本电脑是 macbook,一直在谷歌搜索但找不到正确的答案
回答这个问题可能为时已晚,但我想您需要配置您的excel.php配置文件。
发布excel配置文件:
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"
Run Code Online (Sandbox Code Playgroud)
现在在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,
],
Run Code Online (Sandbox Code Playgroud)
这会将临时文件夹设置为您有权执行事物的存储路径。希望这对其他人有帮助。
| 归档时间: |
|
| 查看次数: |
2545 次 |
| 最近记录: |