gpt4 book ai didi

PHP:如何修复返回 false 的 ftp_mlsd

转载 作者:行者123 更新时间:2023-12-05 04:00:37 25 4
gpt4 key购买 nike

我正在尝试使用 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);

最佳答案

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>

关于PHP:如何修复返回 false 的 ftp_mlsd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56047115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com