Hàm ftp_ssl_connect () trong PHP
Thí dụ
Mở kết nối SSL-FTP an toàn:
<?php
// set up basic SSL connection
$ftp_server = "123.123.123.123";
$ftp_conn = ftp_ssl_connect($ftp_server) or die("Could not connect to $ftp_server");
// login
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
// then do something...
// close SSL connection
ftp_close($ftp_conn);
?>
Định nghĩa và Cách sử dụng
Hàm ftp_ssl_connect () mở một kết nối SSL-FTP an toàn.
Khi kết nối được mở, bạn có thể chạy các chức năng FTP trên máy chủ.
Lưu ý: Chức năng này chỉ khả dụng nếu cả mô-đun ftp và hỗ trợ OpenSSL được tích hợp tĩnh vào PHP.
Cú pháp
ftp_ssl_connect(host, port, timeout);
Giá trị tham số
Parameter | Description |
---|---|
host | Required. Specifies the FTP server address. 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 to connect to. Default is 21 |
timeout | Optional. Specifies the timeout for network operations. Default is 90 seconds |
Chi tiết kỹ thuật
Giá trị trả lại: | Luồng SSL-FTP thành công, FALSE nếu thất bại |
---|---|
Phiên bản PHP: | 4.3+ |
PHP Changelog: | PHP 5.2.2 - Hàm này trả về FALSE nếu nó không thể sử dụng kết nối SSL, thay vì quay trở lại kết nối không phải SSL |
❮ Tham chiếu FTP PHP