failed to open stream: HTTP wrapper does not support writeable connections

前端 未结 3 1428
小蘑菇
小蘑菇 2020-11-28 07:50

I have uploaded my localhost files to my website but it is showing me this error:-

: [2] file_put_contents( ***WebsiteURL*** /cache/lang/ ***FileName*** .php         


        
3条回答
  •  庸人自扰
    2020-11-28 08:33

    you could use fopen() function.

    some example:

    $url = 'http://doman.com/path/to/file.mp4';
    $destination_folder = $_SERVER['DOCUMENT_ROOT'].'/downloads/';
    
    
        $newfname = $destination_folder .'myfile.mp4'; //set your file ext
    
        $file = fopen ($url, "rb");
    
        if ($file) {
          $newf = fopen ($newfname, "a"); // to overwrite existing file
    
          if ($newf)
          while(!feof($file)) {
            fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
    
          }
        }
    
        if ($file) {
          fclose($file);
        }
    
        if ($newf) {
          fclose($newf);
        }
    

提交回复
热议问题