📄 function.ftp-ssl-connect.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Opens an Secure SSL-FTP connection</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ftp-size.html">ftp_size</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ftp-systype.html">ftp_systype</a></div> <div class="up"><a href="ref.ftp.html">FTP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.ftp-ssl-connect" class="refentry"> <div class="refnamediv"> <h1 class="refname">ftp_ssl_connect</h1> <p class="verinfo">(PHP 4 >= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">ftp_ssl_connect</span> — <span class="dc-title">Opens an Secure SSL-FTP connection</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><b><b>ftp_ssl_connect</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$host</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$port</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$timeout</tt></span> ]] )</div> <p class="para rdfs-comment"> <b>ftp_ssl_connect()</b> opens a SSL-FTP connection to the specified <i><tt class="parameter">host</tt></i>. </p> <blockquote><p><b class="note">Note</b>: <b>Why this function may not exist</b><br /> <b>ftp_ssl_connect()</b> is only available if <a href="ref.openssl.html" class="link">OpenSSL</a> support is enabled into your version of PHP. If it's undefined and you've compiled FTP support then this is why. For Windows you must compile your own PHP binaries to support this function. <br /> </p></blockquote> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">host</tt></i></span> <dd> <p class="para"> The FTP server address. This parameter shouldn't have any trailing slashes and shouldn't be prefixed with <i>ftp://</i>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">port</tt></i></span> <dd> <p class="para"> 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. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">timeout</tt></i></span> <dd> <p class="para"> 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 <a href="function.ftp-set-option.html" class="function">ftp_set_option()</a> and <a href="function.ftp-get-option.html" class="function">ftp_get_option()</a>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a SSL-FTP stream on success or <b><tt>FALSE</tt></b> on error. </p> </div> <div class="refsect1 changelog"> <h3 class="title">ChangeLog</h3> <p class="para"> <table class="informaltable"> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Version</th> <th colspan="1">Description</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">5.2.2</td> <td colspan="1" rowspan="1" align="left"> The function was changed to return <b><tt>FALSE</tt></b> when it can't use an SSL connection, instead of fallbacking to a non-SSL one as previously. </td> </tr> </tbody> </colgroup> </table> </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>ftp_ssl_connect()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">// set up basic ssl connection<br /></span><span style="color: #0000BB">$conn_id </span><span style="color: #007700">= </span><span style="color: #0000BB">ftp_ssl_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp_server</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// login with username and password<br /></span><span style="color: #0000BB">$login_result </span><span style="color: #007700">= </span><span style="color: #0000BB">ftp_login</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">, </span><span style="color: #0000BB">$ftp_user_name</span><span style="color: #007700">, </span><span style="color: #0000BB">$ftp_user_pass</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">ftp_pwd</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">); </span><span style="color: #FF8000">// /<br /><br />// close the ssl connection<br /></span><span style="color: #0000BB">ftp_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.ftp-connect.html" class="function" rel="rdfs-seeAlso">ftp_connect()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ftp-size.html">ftp_size</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ftp-systype.html">ftp_systype</a></div> <div class="up"><a href="ref.ftp.html">FTP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -