<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/wrappers.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'wrappers.ftp.php',
    1 => 'ftp://',
    2 => '访问 FTP(s) URLs',
  ),
  'up' => 
  array (
    0 => 'wrappers.php',
    1 => '支持的协议和封装协议',
  ),
  'prev' => 
  array (
    0 => 'wrappers.http.php',
    1 => 'http://',
  ),
  'next' => 
  array (
    0 => 'wrappers.php.php',
    1 => 'php://',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'language/wrappers/ftp.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="wrappers.ftp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ftp://</h1>
  <h1 class="refname">ftps://</h1>
  <p class="refpurpose"><span class="refname">ftp://</span> -- <span class="refname">ftps://</span> &mdash; <span class="dc-title">访问 FTP(s) URLs</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-wrappers.ftp-description">
  <h3 class="title">说明</h3>
  <p class="para">
   允许通过 FTP 读取存在的文件，以及创建新文件。
   如果服务器不支持被动（passive）模式的 FTP，连接会失败。
  </p>
  <p class="simpara">
   打开文件后你既可以读也可以写，但是不能同时进行。
   当远程文件已经存在于 ftp 服务器上，如果尝试打开并写入文件的时候，
   未指定上下文（context）选项 <code class="literal">overwrite</code>，连接会失败。
   
   如果要通过 FTP 覆盖存在的文件，
   指定上下文（context）的 <code class="literal">overwrite</code> 选项来打开、写入。
   另外可使用 <a href="ref.ftp.php" class="link">FTP 扩展</a>来代替。
  </p>
  <p class="simpara">
   如果你设置了 <var class="filename">php.ini</var> 中的 <a href="filesystem.configuration.php#ini.from" class="link">from</a> 指令，
   这个值会作为匿名（anonymous）ftp 的密码。
  </p>
 </div>


 <div class="refsect1 usage" id="refsect1-wrappers.ftp-usage"> 
  <h3 class="title">用法</h3>
  <ul class="itemizedlist">
   <li class="listitem"><span class="simpara"><var class="filename">ftp://example.com/pub/file.txt</var></span></li>
   <li class="listitem"><span class="simpara"><var class="filename">ftp://user:password@example.com/pub/file.txt</var></span></li>
   <li class="listitem"><span class="simpara"><var class="filename">ftps://example.com/pub/file.txt</var></span></li>
   <li class="listitem"><span class="simpara"><var class="filename">ftps://user:password@example.com/pub/file.txt</var></span></li>
  </ul>
 </div>
 

 <div class="refsect1 options" id="refsect1-wrappers.ftp-options">
  <h3 class="title">可选项</h3>
  <p class="para">
   <table class="doctable table">
    <caption><strong>封装协议概要</strong></caption>
    
     <thead>
      <tr>
       <th>属性</th>
       <th>是否支持</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>受 <a href="filesystem.configuration.php#ini.allow-url-fopen" class="link">allow_url_fopen</a> 影响</td>
       <td>是</td>
      </tr>

      <tr>
       <td>允许读取</td>
       <td>是</td>
      </tr>

      <tr>
       <td>允许写入</td>
       <td>是 (新文件/启用 <code class="parameter">overwrite</code> 后已存在的文件)</td>
      </tr>

      <tr>
       <td>允许添加</td>
       <td>是</td>
      </tr>

      <tr>
       <td>允许同时读和写</td>
       <td>否</td>
      </tr>

      <tr>
       <td>支持 <span class="function"><a href="function.stat.php" class="function">stat()</a></span></td>
       <td>
        仅 <span class="function"><a href="function.filesize.php" class="function">filesize()</a></span>、<span class="function"><a href="function.filemtime.php" class="function">filemtime()</a></span>、
        <span class="function"><a href="function.filetype.php" class="function">filetype()</a></span>、 <span class="function"><a href="function.file-exists.php" class="function">file_exists()</a></span>、
        <span class="function"><a href="function.is-file.php" class="function">is_file()</a></span> 和 <span class="function"><a href="function.is-dir.php" class="function">is_dir()</a></span>。
       </td>
      </tr>

      <tr>
       <td>支持 <span class="function"><a href="function.unlink.php" class="function">unlink()</a></span></td>
       <td>是</td>
      </tr>

      <tr>
       <td>支持 <span class="function"><a href="function.rename.php" class="function">rename()</a></span></td>
       <td>是</td>
      </tr>

      <tr>
       <td>支持 <span class="function"><a href="function.mkdir.php" class="function">mkdir()</a></span></td>
       <td>是</td>
      </tr>

      <tr>
       <td>支持 <span class="function"><a href="function.rmdir.php" class="function">rmdir()</a></span></td>
       <td>是</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>
 

 <div class="refsect1 notes" id="refsect1-wrappers.ftp-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    FTPS 仅在 <a href="book.openssl.php" class="link">openssl</a> 扩展开启时有效。
   </p>
   <span class="simpara">
    如果服务器不支持 SSL，这个连接会降级（falls back）到普通未加密的 ftp。
   </span>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <strong>追加</strong><br />
   <span class="simpara">
    文件可以通过
    <code class="literal">ftp://</code> URL 封装器来追加（append）。
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-wrappers.ftp-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><a href="context.ftp.php" class="xref">FTP 上下文选项</a></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>