PHPExcel_Writer_Exception with message “Could not close zip file php://output.”

后端 未结 12 760
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-05 00:30

I\'m using PHPExcel to export some data to user in an excel file. I would like the script to send the excel file to the user immediately after it\'s creation. Here is my tes

12条回答
  •  情书的邮戳
    2020-12-05 01:09

    The most common cause of this error when saving to php://output is an open_basedir restriction that doesn't include a valid system's temp folder (e.g. /tmp), or permissions for the system's temp folder... suhosin can also affect this, even when the obvious permissions appear to be set correctly.

    A possible workround is to write the file to the filesystem in a directory that you know you do have full privileges to write, and then use readfile() to stream that file to php://output before deleting the file

提交回复
热议问题