Php Maatwebsite Excel for Laravel
我以前也做过同样的事情,但是在这段代码中遇到了一个错误:Php Maatwebsite Excel for Laravel,php,laravel,laravel-5.4,maatwebsite-excel,Php,Laravel,Laravel 5.4,Maatwebsite Excel,我以前也做过同样的事情,但是在这段代码中遇到了一个错误: Excel::create('churros_contact', function($excel){ $excel->sheet('contact', function($sheet){ $sheet->fromModel(Contact::all()); }); })->export('xlsx'); 它说: ZipArchive::close():创建临时文件
Excel::create('churros_contact', function($excel){
$excel->sheet('contact', function($sheet){
$sheet->fromModel(Contact::all());
});
})->export('xlsx');
它说:
ZipArchive::close():创建临时文件失败:没有此类文件或目录
在哪里可以修改目录设置?
至于权限,我已经设置好了,所以应该是其他问题。。
我可能遗漏了什么配置
如果我改为XLS,它不会给我错误,但也不会下载
public function csvOrderstatus($id)
{
$result = DB::table('order')->where('id',$id)->first(); // the data you want to download as csv
$csv = (array)$result; // stored the data in a array
return Excel::create('csvfile', function ($excel) use ($csv) {
$excel->sheet('mySheet', function ($sheet) use ($csv) {
$sheet->fromArray($csv);
});
})->download('xls');
}
这对我有用。希望这能对您有所帮助。如果这是一台新机器,您可能缺少一些php扩展?但是如果你使用homestead,那么它就不重要了,这是在我的本地主机中,在上一个项目中,我使用了相同的东西,但什么也没用wrong@lewis4u例如我还没有找到解决办法。我想知道错误在哪里,你有什么线索吗?谢谢你,多排怎么样?->其中('id',$id)->take(10)->get()不起作用