ftp_ssl_connect Opens an Secure SSL-FTP connection php函数


(PHP 4 >= 4.3.0, PHP 5)

ftp_ssl_connectOpens an Secure SSL-FTP connection


resource ftp_ssl_connect ( string $host [, int $port = 21 [, int $timeout = 90 ]] )

ftp_ssl_connect() opens an explicit SSL-FTP connection to the specified host.

Note: Why this function may not exist

ftp_ssl_connect() is only available if both the ftp module and the OpenSSL support is built statically into php, this means that on Windows this function will be undefined in the official PHP builds. To make this function available on Windows you must compile your own PHP binaries.


ftp_ssl_connect() is not intended for use with sFTP. To use sFTP with PHP, please see ssh2_sftp().



The FTP server address. This parameter shouldn't have any trailing slashes and shouldn't be prefixed with ftp://.


This parameter specifies an alternate port to connect to. If it is omitted or set to zero, then the default FTP port, 21, will be used.


This parameter specifies the timeout for all subsequent network operations. If omitted, the default value is 90 seconds. The timeout can be changed and queried at any time with ftp_set_option() and ftp_get_option().


Returns a SSL-FTP stream on success or FALSE on error.


版本 说明
5.2.2 The function was changed to return FALSE when it can't use an SSL connection, instead of fallbacking to a non-SSL one as previously.


Example #1 ftp_ssl_connect() example


// set up basic ssl connection
$conn_id ftp_ssl_connect($ftp_server);

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

ftp_pwd($conn_id); // /

// close the ssl connection


ftp_systype 返回远程 FTP 服务器的操作系统类型
ftruncate 将文件截断到给定的长度
function_exists Return TRUE if the given function has been defined
func_get_arg Return an item from the argument list
func_num_args Returns the number of arguments passed to the function
fwrite 写入文件(可安全用于二进制文件)
gc_collect_cycles Forces collection of any existing garbage cycles
gc_disable Deactivates the circular reference collector
gc_enable Activates the circular reference collector
gc_enabled Returns status of the circular reference collector
gd_info 取得当前安装的 GD 库的信息
getallheaders Fetch all HTTP request headers
getcwd 取得当前工作目录
getdate 取得日期/时间信息

Copyright © 2016 phpStudy |