PHP ftp_connect() 함수
예시
연결, 로그인 및 FTP 연결 닫기:
<?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);
// then do something...
// close connection
ftp_close($ftp_conn);
?>
정의 및 사용
ftp_connect() 함수는 지정된 호스트에 대한 FTP 연결을 엽니다.
연결이 열리면 서버에 대해 FTP 기능을 실행할 수 있습니다.
통사론
ftp_connect(host, port, timeout);
매개변수 값
Parameter | Description |
---|---|
host | Required. Specifies the FTP server to connect to. Can be a domain address or an IP address. This parameter should not be prefixed with "ftp://" or have any trailing slashes |
port | Optional. Specifies the port of the FTP server. Default is port 21 |
timeout | Optional. Specifies the timeout for all subsequent network operations. Default is 90 seconds |
기술적 세부 사항
반환 값: | 성공 시 FTP 스트림 또는 오류 시 FALSE |
---|---|
PHP 버전: | 4+ |
PHP 변경 로그: | PHP 4.2.0에 timeout 매개변수가 추가되었습니다 . |
❮ PHP FTP 참조