ftp_nlist

(PHP 4, PHP 5, PHP 7)

ftp_nlist锟斤拷锟截革拷锟斤拷目录锟斤拷锟侥硷拷锟叫憋拷

说锟斤拷

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

锟斤拷锟斤拷

ftp_stream

FTP 锟斤拷锟斤拷锟斤拷源锟斤拷

directory

指锟斤拷要锟叫憋拷锟侥柯硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷艽锟斤拷锟斤拷锟斤拷锟斤拷锟绞斤拷锟斤拷锟斤拷纾� ftp_nlist($conn_id, "-la /you/dir"); 注锟斤拷瞬锟斤拷锟斤拷锟斤拷源锟斤拷锟街碉拷锟斤拷锟斤拷锟斤拷锟侥柯硷拷锟斤拷锟斤拷募锟斤拷锟斤拷锟斤拷锟斤拷崭锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟铰o拷锟斤拷锟杰伙拷锟斤拷锟斤拷锟斤拷狻�

锟斤拷锟斤拷值

锟斤拷锟斤拷晒锟斤拷蚍祷馗锟斤拷锟侥柯硷拷碌锟斤拷募锟斤拷锟斤拷锟缴碉拷锟斤拷锟介,锟斤拷锟津返伙拷 FALSE锟斤拷

锟斤拷锟斤拷

Example #1 ftp_nlist() 锟斤拷锟斤拷

<?php

// set up basic connection
$conn_id ftp_connect($ftp_server);
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
    die(
"FTP connection has failed !");
}
 
// get contents of the root directory
$contents ftp_nlist($conn_id"/");

// output $contents
var_dump($contents);

?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

array(3) {
  [0]=>
  string(11) "public_html"
  [1]=>
  string(10) "public_ftp"
  [2]=>
  string(3) "www"

锟轿硷拷

  • ftp_rawlist() - 锟斤拷锟斤拷指锟斤拷目录锟斤拷锟侥硷拷锟斤拷锟斤拷细锟叫憋拷