PHP ftp_connect() İşlevi
Örnek
Bir FTP bağlantısını bağlayın, oturum açın ve kapatın:
<?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);
?>
Tanım ve Kullanım
ftp_connect() işlevi, belirtilen ana bilgisayara bir FTP bağlantısı açar.
Bağlantı açıkken, sunucuya karşı FTP işlevlerini çalıştırabilirsiniz.
Sözdizimi
ftp_connect(host, port, timeout);
Parametre Değerleri
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 |
Teknik detaylar
Geri dönüş değeri: | Başarı durumunda bir FTP akışı veya hata durumunda YANLIŞ |
---|---|
PHP Sürümü: | 4+ |
PHP Değişiklik Günlüğü: | PHP 4.2.0'da zaman aşımı parametresi eklendi |
❮ PHP FTP Referansı