FTP获取所有文件 [英] FTP get all files
问题描述
我已经使用PHP成功连接到了我的FTP,并且可以看到所有文件: ftp_nlist
但是,是否有一种简单的方法可以在当前目录中下载所有这些文件?
我看不到任何示例说明如何执行此操作。
谢谢
另一个简单的解决方案是......
列出数组中的文件并单独下载每个文件。
类似于:
$ contents = ftp_nlist($ conn_id,。);
foreach ; $ value){
$ result = ftp_fget($ conn_id,$ local,& $ value,FTP_BINARY);
}
您可能需要稍微调整代码...
I have successfully connected to my FTP using PHP and I can see all the files using: ftp_nlist
But, is there an easy way to then download all these files in the current directory?
I can't see to find any examples of how I'd do this.
Thanks
Another simple solution is ....
List the files in an array and download each file individually.
Something like:
$contents = ftp_nlist($conn_id, ".");
foreach ($contents as &$value) { $result = ftp_fget($conn_id, $local,&$value, FTP_BINARY); }
You might need to tweak the code a little...
这篇关于FTP获取所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!