PHP ftp_nlist() 函数

PHP 教程 · 2019-01-26 10:59:03

定义和用法

ftp_nlist() 函数返回 FTP 服务器上指定目录的文件列表。

如果成功,则返回指定目录下的文件名组成的数组。如果失败,则返回 FALSE。

语法


ftp_nlist(ftp_connection,dir)


参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
dir 必需。规定要检查的目录。请使用 "." 来获得当前目录。

提示和注释

注释:该函数不适用于 IIS (Internet Information Server)。它返回 nothing。

实例


<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
print_r(ftp_nlist($conn,"images"));
ftp_close($conn);
?>

上面的代码将输出:


array(3)
{
[0]=> "flower.gif"
[1]=> "car.gif"
[2]=> "house.gif"
}


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Web Design for ROI

Web Design for ROI

Lance Loveday、Sandra Niehaus / New Riders Press / 2007-10-27 / USD 39.99

Your web site is a business--design it like one. Billions of dollars in spending decisions are influenced by web sites. So why aren't businesses laser-focused on designing their sites to maximize thei......一起来看看 《Web Design for ROI》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具