PHP ftp_rawlist() 함수
예시
파일 정보가 있는 파일 목록 가져오기:
<?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 the file list for /
$filelist = ftp_rawlist($ftp_conn, "/");
// close connection
ftp_close($ftp_conn);
// output $filelist
var_dump($filelist);
?>
출력은 다음과 같을 수 있습니다.
array(3)
{
[0] => string(57) "drw-rw-rw- 1 user group 0 Jan 03 08:33 images"
[1] => string(62) "-rw-rw-rw- 1 user group 160 Feb 16 13:54 php"
[2] => string(75) "-rw-rw-rw- 1 user group 20 Feb 14 12:22 test"
}
정의 및 사용
ftp_rawlist() 함수는 (FTP 서버의 지정된 디렉토리에서) 파일 정보가 있는 파일 목록을 반환합니다.
통사론
ftp_rawlist(ftp_conn, dir, recursive);
매개변수 값
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
dir | Required. Specifies the directory path. May include arguments for the LIST command. Tip: Use "." to specify the current directory |
recursive | Optional. By default, this function sends a "LIST" command to the server. However, if the recursive parameter is set to TRUE, it sends a "LIST -R" command |
기술적 세부 사항
반환 값: | 각 요소가 텍스트의 한 줄에 해당하는 배열입니다(파싱이 수행되지 않음). 실패시 FALSE를 반환 |
---|---|
PHP 버전: | 4+ |
PHP 변경 로그: | PHP 4.3에 재귀 매개변수가 추가되었습니다 . |
❮ PHP FTP 참조