Current Location: Home> Function Categories> ftp_nlist

ftp_nlist

Returns the list of files in the specified directory.
Name:ftp_nlist
Category:Uncategorized
Programming Language:php
One-line Description:Returns the list of files in the specified directory.

Definition and usage

ftp_nlist() function returns a list of files in the specified directory.

If successful, return an array of file names in the given directory, otherwise false.

实例

<?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"
}

grammar

 ftp_nlist ( ftp_connection , dir )
parameter describe
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
dir Required. Specify the directory to be inspected. Use "." to get the current directory.
Similar Functions
Popular Articles