PHP ftp_nlist() 함수
예시
현재 디렉토리의 파일 나열:
<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
// get file list of current directory
$file_list = ftp_nlist($ftp_conn, ".");
var_dump($file_list);
// close connection
ftp_close($ftp_conn);
?>
정의 및 사용
ftp_nlist() 함수는 FTP 서버의 지정된 디렉토리에 있는 파일 목록을 반환합니다.
통사론
ftp_nlist(ftp_conn, dir);
매개변수 값
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
dir | Required. Specifies the directory to be listed. Use "." to get the current directory |
기술적 세부 사항
반환 값: | 성공 시 지정된 디렉토리의 파일 이름 배열, 실패 시 FALSE |
---|---|
PHP 버전: | 4+ |
❮ PHP FTP 참조