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 enchant 函数 get the directory path for a given backendphp enchant 函数 returns a list of available dictionariesphp ftp 函数 returns a list of files in the given directoryphp 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 an array of messages matching the given search criteriaphp mailparse 函数 returns a handle on a given section in a mimemessagephp maxdb 函数 returns whether thread safety is given or notphp maxdb 函数 returns the number of warnings from the last query for the given linkphp mysqlnd ms 函数 returns a list of currently configured serversphp mysqlnd qc 函数 returns a list of available storage handlerphp 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 函数 returns the length of a file from a given version of the fsphp svn 函数 creates a new empty directory returns true if all is ok false otherwisephp svn 函数 returns list of directory contents in repository url optionally at revision numberphp 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 graphphp sdo das xml 函数 returns sdo das xml document object for a given path to xml instance documentphp sdo das xml 函数 returns sdo das xml document for a given xml instance string
关注编程学问公众号