Stream FTP download to output

后端 未结 6 1190
耶瑟儿~
耶瑟儿~ 2020-12-03 06:06

I am trying to stream/pipe a file to the user\'s browser through HTTP from FTP. That is, I am trying to print the contents of a file on an FTP server.

This is what

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 06:37

    Sounds like you need to turn off output buffering for that page, otherwise PHP will try to fit it in all memory.

    An easy way to do this is something like:

    while (ob_end_clean()) {
        ; # do nothing
    }
    

    Put that ahead of your call to ->get(), and I think that will resolve your issue.

提交回复
热议问题