PHP FTP 함수
PHP FTP 소개
FTP 기능은 클라이언트가 FTP(파일 전송 프로토콜)를 통해 파일 서버에 액세스할 수 있도록 합니다.
FTP 기능은 연결을 열고, 로그인하고, 닫을 뿐만 아니라 파일 서버에서 파일에 대한 정보를 업로드, 다운로드, 이름 바꾸기, 삭제 및 가져오는 데 사용됩니다. 모든 FTP 기능이 모든 서버에서 작동하거나 동일한 결과를 반환하는 것은 아닙니다. FTP 기능은 PHP 3에서 사용할 수 있게 되었습니다.
FTP 서버의 파일에서 읽거나 쓰기만 하려는 경우 더 간단하고 직관적인 인터페이스를 제공하는 파일 시스템 기능과 함께 ftp:// 래퍼를 사용하는 것을 고려하십시오.
설치
이러한 기능이 작동하려면 --enable-ftp를 사용하여 PHP를 컴파일해야 합니다.
Windows 버전의 PHP는 이 확장을 기본적으로 지원합니다.
PHP FTP 함수
Function | Description |
---|---|
ftp_alloc() | Allocates space for a file to be uploaded to the FTP server |
ftp_cdup() | Changes to the parent directory on the FTP server |
ftp_chdir() | Changes the current directory on the FTP server |
ftp_chmod() | Sets permissions on a file via FTP |
ftp_close() | Closes an FTP connection |
ftp_connect() | Opens an FTP connection |
ftp_delete() | Deletes a file on the FTP server |
ftp_exec() | Executes a command on the FTP server |
ftp_fget() | Downloads a file from the FTP server and saves it into an open local file |
ftp_fput() | Uploads from an open file and saves it to a file on the FTP server |
ftp_get() | Downloads a file from the FTP server |
ftp_get_option() | Returns runtime options of the FTP connection |
ftp_login() | Logs in to the FTP connection |
ftp_mdtm() | Returns the last modified time of a specified file |
ftp_mkdir() | Creates a new directory on the FTP server |
ftp_mlsd() | Returns the list of files in the specified directory |
ftp_nb_continue() | Continues retrieving/sending a file (non-blocking) |
ftp_nb_fget() | Downloads a file from the FTP server and saves it into an open file (non-blocking) |
ftp_nb_fput() | Uploads from an open file and saves it to a file on the FTP server (non-blocking) |
ftp_nb_get() | Downloads a file from the FTP server (non-blocking) |
ftp_nb_put() | Uploads a file to the FTP server (non-blocking) |
ftp_nlist() | Returns a list of files in the specified directory on the FTP server |
ftp_pasv() | Turns passive mode on or off |
ftp_put() | Uploads a file to the FTP server |
ftp_pwd() | Returns the current directory name |
ftp_quit() | Alias of ftp_close() |
ftp_raw() | Sends a raw command to the FTP server |
ftp_rawlist() | Returns a list of files with file information from a specified directory |
ftp_rename() | Renames a file or directory on the FTP server |
ftp_rmdir() | Deletes an empty directory on the FTP server |
ftp_set_option() | Sets runtime options for the FTP connection |
ftp_site() | Sends an FTP SITE command to the FTP server |
ftp_size() | Returns the size of the specified file |
ftp_ssl_connect() | Opens a secure SSL-FTP connection |
ftp_systype() | Returns the system type identifier of the FTP server |
PHP 사전 정의 FTP 상수
Constant | Type | Description |
---|---|---|
FTP_ASCII | Integer | |
FTP_AUTOSEEK | Integer | |
FTP_AUTORESUME | Integer | |
FTP_BINARY | Integer | |
FTP_FAILED | Integer | Asynchronous transfer has failed |
FTP_FINISHED | Integer | Asynchronous transfer is completed |
FTP_IMAGE | Integer | Alias of FTP_BINARY |
FTP_MOREDATA | Integer | Asynchronous transfer is in progress |
FTP_TEXT | Integer | Alias of FTP_ASCII |
FTP_TIMEOUT_SEC | Integer | The timeout used for network operations |
FTP_USEPASVADDRESS | Boolean |