为什么ftp_nlist为非空目录返回一个空数组? [英] Why is ftp_nlist returning an empty array for a non-empty directory?

查看:188
本文介绍了为什么ftp_nlist为非空目录返回一个空数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

  $ file_list在我的代码中的下面这行代码返回一个空数组= @ftp_nlist($ link,'-a'。$ path); 

路径上的权限为775.当我 ls 我的OS shell中的路径,我看到了预期的文件列表。



那么为什么不是 ftp_nlist 看到它们?

很可能是因为FTP服务器不理解 -a 。它试图将其解释为路径或文件掩码。它不匹配任何文件,因此是空的结果集。



尝试删除开关。




请注意,虽然有些服务器确实支持 -a ,或者至少能够忽略它,但它违反了FTP规范。在 NLST 命令(或任何其他FTP命令)中根本没有任何开关。


The following line in my code is returning an empty array when in fact the given path is not empty:

$file_list = @ftp_nlist( $link, '-a ' . $path );

The permission on the path is 775. When I ls the path in my OS shell, I see the expected list of files.

So why isn't ftp_nlist seeing them?

解决方案

Most likely because the FTP server does not understand the -a. It tries to interpret it as a path or a file mask. It matches no file, hence the empty result set.

Try to remove the switch.


Note that while some servers do support the -a, or are at least able to ignore it, it violates the FTP specification. There are no switches at all in NLST command (or any other FTP command).

这篇关于为什么ftp_nlist为非空目录返回一个空数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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