FTP获取所有文件 [英] FTP get all files

查看:89
本文介绍了FTP获取所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆