报错 Could not open php://output for writing

浏览:1260 发布日期:2019/05/20 分类:功能实现
PHP 使用PhpExcle导出报错 Could not open php://output for writing

欢迎加TP5交流群 :310325131
原文链接:http://cssnb.com/index.php/archives/104/$objWriter->save('php://output'); 改为$this->SaveViaTempFile($objWriter);public function SaveViaTempFile($objWriter){
        $filePath = sys_get_temp_dir() . "/" . rand(0, getrandmax()) . rand(0, getrandmax()) . ".tmp";
        $objWriter->save($filePath);
        readfile($filePath);
        unlink($filePath);
    }
如果修复后报错ZipArchive::close(): Failure to create temporary file: Permission denied看报错明细指向那个目录权限不足就去开启即可修改对应目录权限为777 就能解决。

参考网址:http://cssnb.com/index.php/archives/104/
评论( 相关
后面还有条评论,点击查看>>