我想创建下载使用laravel-excel.maatwebsitelibrary Excel函数。我的代码如下图所示:
return Excel::download(new PembukuanExport, 'pembukuan.xlsx');
但是当我运行它,它给了我的错误是这样
无法打开的/ var /文件夹/ N_ / xh_10hm50dvbwg23cfq_kw3h0000gn / T / laravel-Excel的DMBN3reNUrSiamYT进行写入。
我的笔记本电脑是的MacBook,一直使用Google,但无法找到正确的答案
我在httpd.conf中`改变User & Group
解决了这个。
httpd.config
。User your_mac_user
和Group staff
填写这可能是来不及回答这个问题,但我猜你需要配置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,
],
这将设置临时文件夹具有执行权限的东西您的存储路径。希望这个发现帮助他人。