PhpSpreadsheet 无法保存到服务器
PhpSpreadsheet could not save to server
我正在尝试使用 PhpSpreadsheet 将 excel 文件写入并保存到文件服务器。
这是我的代码:
$path = 'http://192.168.3.81/erpFile/'.time().'.xlsx';
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->save($path);
但我收到以下错误消息:
A PHP Error was encountered
Severity: Warning
Message: ZipArchive::close(): Failure to create temporary file: No such file or directory
An uncaught Exception was encountered
Type: PhpOffice\PhpSpreadsheet\Writer\Exception
Message: Could not close zip file http://192.168.3.81/erpFile/1530169174.xlsx.
目录权限已经设置为777,请帮忙。谢谢
您必须使用系统文件路径。像这样:
$path = FCPATH.'erpFile'.DIRECTORY_SEPARATOR.time().'.xlsx';
我正在尝试使用 PhpSpreadsheet 将 excel 文件写入并保存到文件服务器。 这是我的代码:
$path = 'http://192.168.3.81/erpFile/'.time().'.xlsx';
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Excel2007');
$writer->save($path);
但我收到以下错误消息:
A PHP Error was encountered
Severity: Warning
Message: ZipArchive::close(): Failure to create temporary file: No such file or directory
An uncaught Exception was encountered
Type: PhpOffice\PhpSpreadsheet\Writer\Exception
Message: Could not close zip file http://192.168.3.81/erpFile/1530169174.xlsx.
目录权限已经设置为777,请帮忙。谢谢
您必须使用系统文件路径。像这样:
$path = FCPATH.'erpFile'.DIRECTORY_SEPARATOR.time().'.xlsx';