How download big file using PHP (low memory usage)

后端 未结 2 765
梦如初夏
梦如初夏 2020-12-02 19:34

I have to download big file (1xx MB) using PHP.

How can i download this without wasting memory (RAM) for temporary file ?

When i use

$someth         


        
2条回答
  •  臣服心动
    2020-12-02 20:18

    you can shell out to a wget using exec() this will result in the lowest memory usage.

    
    

    You can also try using fopen() and fread() and fwrite(). That way you onlly download x bytes into memory at a time.

提交回复
热议问题