ftp_mlsd

(PHP 7 >= 7.2.0)

ftp_mlsdReturns a list of files in the given directory

说明

ftp_mlsd ( resource $ftp_stream , string $directory ) : array

参数

ftp_stream

The link identifier of the FTP connection.

directory

The directory to be listed.

返回值

Returns an array of arrays with file infos from the specified directory on success or FALSE on error.

范例

Example #1 ftp_mlsd() example

<?php

// set up basic connection
$conn_id ftp_connect($ftp_server);

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

// get contents of the current directory
$contents ftp_mlsd($conn_id".");

// output $contents
var_dump($contents);

?>

以上例程的输出类似于:

array(5) {
  [0]=>
  array(8) {
    ["name"]=>
    string(1) "."
    ["modify"]=>
    string(14) "20171212154511"
    ["perm"]=>
    string(7) "flcdmpe"
    ["type"]=>
    string(4) "cdir"
    ["unique"]=>
    string(11) "811U5740002"
    ["UNIX.group"]=>
    string(2) "33"
    ["UNIX.mode"]=>
    string(4) "0755"
    ["UNIX.owner"]=>
    string(2) "33"
  }
  [1]=>
  array(8) {
    ["name"]=>
    string(2) ".."
    ["modify"]=>
    string(14) "20171212154511"
    ["perm"]=>
    string(7) "flcdmpe"
    ["type"]=>
    string(4) "pdir"
    ["unique"]=>
    string(11) "811U5740002"
    ["UNIX.group"]=>
    string(2) "33"
    ["UNIX.mode"]=>
    string(4) "0755"
    ["UNIX.owner"]=>
    string(2) "33"
  }
  [2]=>
  array(8) {
    ["name"]=>
    string(11) "public_html"
    ["modify"]=>
    string(14) "20171211171525"
    ["perm"]=>
    string(7) "flcdmpe"
    ["type"]=>
    string(3) "dir"
    ["unique"]=>
    string(11) "811U5740525"
    ["UNIX.group"]=>
    string(2) "33"
    ["UNIX.mode"]=>
    string(4) "0755"
    ["UNIX.owner"]=>
    string(2) "33"
  }
  [3]=>
  array(8) {
    ["name"]=>
    string(10) "public_ftp"
    ["modify"]=>
    string(14) "20171211174536"
    ["perm"]=>
    string(7) "flcdmpe"
    ["type"]=>
    string(3) "dir"
    ["unique"]=>
    string(11) "811U57405EE"
    ["UNIX.group"]=>
    string(2) "33"
    ["UNIX.mode"]=>
    string(4) "0755"
    ["UNIX.owner"]=>
    string(2) "33"
  }
  [4]=>
  array(8) {
    ["name"]=>
    string(3) "www"
    ["modify"]=>
    string(14) "www"
    ["perm"]=>
    string(7) "flcdmpe"
    ["type"]=>
    string(3) "dir"
    ["unique"]=>
    string(11) "811U5740780"
    ["UNIX.group"]=>
    string(2) "33"
    ["UNIX.mode"]=>
    string(4) "0755"
    ["UNIX.owner"]=>
    string(2) "33"
  }
}

参见

相关文章
php dba 函数 list all open database filesphp enchant 函数 get the directory path for a given backendphp fam 函数 monitor a collection of files in a directory for changesphp ftp 函数 returns a list of files in the given directoryphp gnupg 函数 returns an array with information about all keys that matches the given patternphp imap 函数 returns the list of mailboxes that matches the given textphp imap 函数 returns a properly formatted email address given the mailbox host and personal infophp imap 函数 this function returns the uid for the given message sequence numberphp maxdb 函数 returns whether thread safety is given or notphp sqlite 函数 execute a query against a given database and returns an arrayphp sqlite 函数 executes a query against a given database and returns a result handlephp svn 函数 copies a file or a directory returns true if all is ok false otherwisephp svn 函数 enumerates the directory entries under path; returns a hash of dir names to file typephp svn 函数 returns a stream to access the contents of a file from a given version of the fsphp svn 函数 returns the length of a file from a given version of the fsphp svn 函数 returns list of directory contents in repository url optionally at revision numberphp hyperwave api 函数 returns value for a given languagephp hyperwave api 函数 returns a list of all source anchorsphp hyperwave api 函数 returns a list of all logged in usersphp sdo das relational 函数 executes a given sql query against a relational database and returns the results as a normalised data graph
关注编程学问公众号