<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >ftp_ssl_connect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="FTP 函数" HREF="ref.ftp.html"><LINK REL="PREVIOUS" TITLE="ftp_size" HREF="function.ftp-size.html"><LINK REL="NEXT" TITLE="ftp_systype" HREF="function.ftp-systype.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ftp-size.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ftp-systype.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ftp-ssl-connect" ></A >ftp_ssl_connect</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN62466" ></A ><P > (PHP 4 >= 4.3.0, PHP 5)</P >ftp_ssl_connect -- Opens an Secure SSL-FTP connection</DIV ><DIV CLASS="refsect1" ><A NAME="AEN62469" ></A ><H2 >说明</H2 >resource <B CLASS="methodname" >ftp_ssl_connect</B > ( string host [, int port [, int timeout]] )<BR ></BR ><P > <B CLASS="function" >ftp_ssl_connect()</B > opens a SSL-FTP connection to the specified <CODE CLASS="parameter" >host</CODE >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Why this function may not exist: </B > <B CLASS="function" >ftp_ssl_connect()</B > is only available if <A HREF="ref.openssl.html" >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. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN62491" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >host</CODE ></DT ><DD ><P > The FTP server address. This parameter shouldn't have any trailing slashes and shouldn't be prefixed with <TT CLASS="literal" >ftp://</TT >. </P ></DD ><DT ><CODE CLASS="parameter" >port</CODE ></DT ><DD ><P > 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 ><CODE CLASS="parameter" >timeout</CODE ></DT ><DD ><P > 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" ><B CLASS="function" >ftp_set_option()</B ></A > and <A HREF="function.ftp-get-option.html" ><B CLASS="function" >ftp_get_option()</B ></A >. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN62513" ></A ><H2 >返回值</H2 ><P > Returns a SSL-FTP stream on success or <TT CLASS="constant" ><B >FALSE</B ></TT > on error. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN62517" ></A ><H2 >更新日志</H2 ><P > <DIV CLASS="informaltable" ><P ></P ><A NAME="AEN62520" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >版本</TH ><TH >说明</TH ></TR ></THEAD ><TBODY ><TR ><TD >5.2.2</TD ><TD > The function was changed to return <TT CLASS="constant" ><B >FALSE</B ></TT > when it can't use an SSL connection, instead of fallbacking to a non-SSL one as previously. </TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN62531" ></A ><H2 >范例</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN62534" ></A ><P ><B >例 1. <B CLASS="function" >ftp_ssl_connect()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /><br /></font><font color="#FF8000">// set up basic ssl connection<br /></font><font color="#0000BB">$conn_id </font><font color="#007700">= </font><font color="#0000BB">ftp_ssl_connect</font><font color="#007700">(</font><font color="#0000BB">$ftp_server</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// login with username and password<br /></font><font color="#0000BB">$login_result </font><font color="#007700">= </font><font color="#0000BB">ftp_login</font><font color="#007700">(</font><font color="#0000BB">$conn_id</font><font color="#007700">, </font><font color="#0000BB">$ftp_user_name</font><font color="#007700">, </font><font color="#0000BB">$ftp_user_pass</font><font color="#007700">);<br /><br />echo </font><font color="#0000BB">ftp_pwd</font><font color="#007700">(</font><font color="#0000BB">$conn_id</font><font color="#007700">); </font><font color="#FF8000">// /<br /><br />// close the ssl connection<br /></font><font color="#0000BB">ftp_close</font><font color="#007700">(</font><font color="#0000BB">$conn_id</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN62538" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.ftp-connect.html" ><B CLASS="function" >ftp_connect()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ftp-size.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ftp-systype.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ftp_size</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ftp.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ftp_systype</TD ></TR ></TABLE ></DIV ></BODY ></HTML >