我正在尝试使用mlsd从ftp服务器获取所有文件,但是ftp_mlsd()函数始终返回false。
我要连接的服务器是测试服务器:speedtest.tele2.net。使用ftp_nlist()时,连接确实有效。
我的当前代码:
$host = "speedtest.tele2.net";
$ftpConnection = ftp_connect($host);
$login = ftp_login($ftpConnection,'anonymous','password');
$directory = ftp_mlsd($ftpConnection,'.');
var_dump($directory);
ftp_close($ftpConnection);
答案 0 :(得分:0)
FTP服务器不支持MLSD
命令。
C:\>ftp speedtest.tele2.net
Connected to speedtest.tele2.net.
220 (vsFTPd 3.0.3)
200 Always in UTF8 mode.
User (speedtest.tele2.net:(none)): anonymous
331 Please specify the password.
Password:
230 Login successful.
ftp> quote FEAT
211-Features: # It's not announced in features list
EPRT
EPSV
MDTM
PASV
REST STREAM
SIZE
TVFS
211 End
ftp> quote MLSD
500 Unknown command. # And the response is also pretty clear
ftp>