PhpSpreadsheet: Permissions | ZipArchive::close(): Failure to create temporary file

前端 未结 3 600
梦毁少年i
梦毁少年i 2021-01-18 10:53

I would like to offer an Excel-File for download with PhpSpreadsheet

Here is my code:

    require \'vendor/autoload.php\';

    use PhpOffice\\PhpSpr         


        
3条回答
  •  太阳男子
    2021-01-18 11:32

    I don't know if your code is from an included file but I had a similar issue. I tried to use __DIR__ constant and it worked, my code looks like this:

    $filepath = __DIR__ . "/reports/${filename}_".date("Ymd_Gis").".xlsx";
    $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
    $writer->save($filepath);
    

提交回复
热议问题