PHP ftp_ssl_connect()ฟังก์ชั่น
ตัวอย่าง
เปิดการเชื่อมต่อ SSL-FTP ที่ปลอดภัย:
<?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);
?>
ความหมายและการใช้งาน
ฟังก์ชัน ftp_ssl_connect() จะเปิดการเชื่อมต่อ SSL-FTP ที่ปลอดภัย
เมื่อเปิดการเชื่อมต่อ คุณสามารถเรียกใช้ฟังก์ชัน FTP กับเซิร์ฟเวอร์ได้
หมายเหตุ:ฟังก์ชันนี้จะใช้ได้ก็ต่อเมื่อทั้งโมดูล ftp และการสนับสนุน OpenSSL สร้างขึ้นใน PHP แบบสแตติก
ไวยากรณ์
ftp_ssl_connect(host, port, timeout);
ค่าพารามิเตอร์
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 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | สตรีม SSL-FTP เมื่อสำเร็จ FALSE เมื่อล้มเหลว |
---|---|
รุ่น PHP: | 4.3+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.2.2 - ฟังก์ชันนี้จะคืนค่า FALSE หากไม่สามารถใช้การเชื่อมต่อ SSL แทนการย้อนกลับไปยังการเชื่อมต่อที่ไม่ใช่ SSL |
❮ การอ้างอิง PHP FTP