美文网首页
Laravel PhpSpreadsheet open_bas

Laravel PhpSpreadsheet open_bas

作者: soeben | 来源:发表于2018-02-12 02:43 被阅读0次

在Laravel中使用PhpSpreadsheet导出excel时一般有两种方案

$writer->save('php://output');//直接输出到浏览器
$writer->save($path); //先保存为文件
echo file_get_contents($path);//再输出文件

但经过测试,这两种方案都依赖着php的临时文件目录,因此都需要在php.ini中将临时文件目录添加至open_basedir 中

[HOST=location]
open_basedir=/tmp

若要添加多个路径请使用:间隔

[HOST=location]
open_basedir=/tmp:/home/www

相关文章

网友评论

      本文标题:Laravel PhpSpreadsheet open_bas

      本文链接:https://www.haomeiwen.com/subject/bnfrtftx.html