我正在 laravel 5.2 中处理 cron 作业,当我尝试从计划中调用 Controller 函数以创建 excel 表时出现错误。但在 postman 中运行良好。
ZipArchive::close():创建临时文件失败:/var/www/html/Expenses/vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007.php 中没有这样的文件或目录: 398
zipArchive 的临时文件权限有问题吗?
将 phpexcel 工作表保存到目录 (777) 时出现上述错误。
$excel_path = 'SubmittedSheets/'.$userId.'-'.uniqid().'.xlsx';
$objWriter->save($excel_path);
最佳答案
需要绝对路径才能在 AWS Ec2 Linux 中为 PHPExcel 保存 excel 文件。
$excel_path = '/var/www/html/MyProject/public/SubmittedSheets/'.$userId.'-'.uniqid().'.xlsx';
$objWriter->save($excel_path);
关于php - ZipArchive::close():无法在 AWS EC2 Linux 中创建临时文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43842824/