ftp_mlsd()

创建于 2024-12-03 / 87
字体: [默认] [大] [更大]

❮ PHP FTP 参考手册

实例

返回 "images" 目录中的文件列表:

<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);

$dir = "/images";
$dirlist = ftp_mlsd($ftp_conn, $dir);

// output directory list
echo($dirlist);

// close connection
ftp_close($ftp_conn);
?>

定义和用法

ftp_mlsd() 函数返回指定目录中的文件列表。

语法

ftp_mlsd(ftp_conn, dir);

参数值

参数 描述
ftp_conn 必需。指定要使用的 FTP 连接
目录 必需。指定要列出的目录的名称。 使用 "." 获取当前目录


技术细节

返回值: 一个数组,包含指定目录中的文件信息,成功,FALSE 失败
PHP 版本: 7.2+

❮ PHP FTP 参考手册
0 人点赞过