简体   繁体   English

无法将文件从远程服务器传输到本地文件夹

[英]Cant transfer file from remote server to local folder

I have an issue using this code to transfer files from a remote server to my computer's drive c folder. 使用此代码将文件从远程服务器传输到计算机的驱动器c文件夹时出现问题。

$file = file_get_contents('http://www.affiliatewindow.com/logos/1961/logo.gif');
file_put_contents('C:/myDir/myFile.gif', $file);

Any workaround about this? 有任何解决方法吗?

Change the slashes (/) in to backslashes (\\) in the file_put_contents function. file_put_contents函数中将斜杠(/)更改为反斜杠(\\)。 You can also try the function realpath : http://php.net/manual/de/function.realpath.php 您也可以尝试使用功能realpathhttp : //php.net/manual/de/function.realpath.php

Another reason is, that the PHP File don't have the permission to write directly on the C drive. 另一个原因是,PHP文件无权直接在C驱动器上写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM