【发布时间】:2017-04-19 20:19:46
【问题描述】:
我想将远程 ftp 服务器上的文件读取到变量中。我试着用地址阅读
fopen("ftp://user:pass@localhost/filetoread");
和
$contents = file_get_contents('ftp://ftpuser:123456789@localhost/file.conf');
echo $contents;
两者都不起作用。我还尝试直接将GET 请求发送到同样不起作用的 URL。不下载如何读取 FTP 文件?
我检查了 php 警告,上面写着:
PHP 警告:file_get_contents(ftp://...@localhost/file.conf):打开流失败:FTP 服务器报告 550 无法获取文件大小。
在第 2 行的 /var/www/html/api/listfolder.php 中
我确定文件存在
【问题讨论】: