Laravel 4.2上如何配置和使用盒子喷口



我需要配置并在laravel 4.2上使用框喷口,但是库不起作用。我运行了命令以安装作曲家依赖项:

composer require box/spout

但是,代码不起作用:

$writer = WriterFactory::create(Type::XLSX); // for XLSX files
$filePath = public_path() . "/relatorios/test.xlsx";
$writer->openToFile($filePath);
$singleRow = ['No'=>1,'Nama'=>'Bayummic','Nilai'=>11,'Nim'=>14140101];
$writer->addRow($singleRow); // add a row at a time
$writer->close();

错误消息:

[2016-12-07 17:35:38] production.INFO: D:ProjetosTestesLaravelQueuespublic [] []
[2016-12-07 17:35:38] production.ERROR: exception 'BoxSpoutCommonExceptionIOException' with message 'Cannot perform I/O operation outside of the base folder: C:WindowsTemp' in D:ProjetosTestesLaravelQueuesvendorboxspoutsrcSpoutCommonHelperFileSystemHelper.php:130

感谢您的收听。

似乎在创建XLSX文件的默认临时文件夹中似乎有问题。您可以在调用openToFile()覆盖默认位置之前尝试使用$writer->setTempFolder('PATH/TO/CUSTOM/TEMP/FOLDER');

相关内容

  • 没有找到相关文章

最新更新