php : get file contents and store file in particular folder

前端 未结 3 851
一生所求
一生所求 2021-02-02 12:30

I am getting file contents from the file_get_contents() function in php and I want to store that file in a particular folder. How would I do that?

         


        
相关标签:
3条回答
  • 2021-02-02 12:34

    Apart from the mentioned file_put_contents, you could take a look at the example of the fwrite function.

    0 讨论(0)
  • 2021-02-02 12:41

    If you're using php 5, you can use file_put_contents:

    file_put_contents('/path/to/file.dat', $data);

    0 讨论(0)
  • 2021-02-02 12:58

    Use file_put_contents()

    $image = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
    file_put_contents('./myDir/myFile.gif', $image);
    
    0 讨论(0)
提交回复
热议问题