<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.ziparchive.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'ziparchive.getexternalattributesindex.php',
    1 => 'ZipArchive::getExternalAttributesIndex',
    2 => 'Retrieve the external attributes of an entry defined by its index',
  ),
  'up' => 
  array (
    0 => 'class.ziparchive.php',
    1 => 'ZipArchive',
  ),
  'prev' => 
  array (
    0 => 'ziparchive.getcommentname.php',
    1 => 'ZipArchive::getCommentName',
  ),
  'next' => 
  array (
    0 => 'ziparchive.getexternalattributesname.php',
    1 => 'ZipArchive::getExternalAttributesName',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/zip/ziparchive/getexternalattributesindex.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ziparchive.getexternalattributesindex" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ZipArchive::getExternalAttributesIndex</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.6.0, PHP 7, PHP 8, PECL zip &gt;= 1.12.4)</p><p class="refpurpose"><span class="refname">ZipArchive::getExternalAttributesIndex</span> &mdash; <span class="dc-title">Retrieve the external attributes of an entry defined by its index</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-ziparchive.getexternalattributesindex-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ZipArchive::getExternalAttributesIndex</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$index</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$opsys</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$attr</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Retrieve the external attributes of an entry defined by its index.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-ziparchive.getexternalattributesindex-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">index</code></dt>
     <dd>
      <p class="para">
       Index of the entry.
      </p>
     </dd>
    
    
     <dt><code class="parameter">opsys</code></dt>
     <dd>
      <p class="para">
       On success, receive the operating system code defined by one of the ZipArchive::OPSYS_ constants.
      </p>
     </dd>
    
    
     <dt><code class="parameter">attr</code></dt>
     <dd>
      <p class="para">
       On success, receive the external attributes. Value depends on operating system.
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       If flags is set to <strong><code><a href="zip.constants.php#ziparchive.constants.fl-unchanged">ZipArchive::FL_UNCHANGED</a></code></strong>, the original unchanged
       attributes are returned.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-ziparchive.getexternalattributesindex-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, 或者在失败时返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-ziparchive.getexternalattributesindex-examples">
  <h3 class="title">示例</h3>
    <p class="para">
      This example extract all the entries of a ZIP
      archive <var class="filename">test.zip</var> and 
      set the Unix rights from external attributes.
    </p>
    <div class="example" id="ziparchive.getexternalattributesindex.examples.perms">
     <p><strong>示例 #1 Extract all entries with Unix rights</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$zip </span><span style="color: #007700">= new </span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">();<br />if (</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">open</span><span style="color: #007700">(</span><span style="color: #DD0000">'test.zip'</span><span style="color: #007700">) === </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">) {<br />    for (</span><span style="color: #0000BB">$idx</span><span style="color: #007700">=</span><span style="color: #0000BB">0 </span><span style="color: #007700">; </span><span style="color: #0000BB">$s </span><span style="color: #007700">= </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">statIndex</span><span style="color: #007700">(</span><span style="color: #0000BB">$idx</span><span style="color: #007700">) ; </span><span style="color: #0000BB">$idx</span><span style="color: #007700">++) {<br />        if (</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">extractTo</span><span style="color: #007700">(</span><span style="color: #DD0000">'.'</span><span style="color: #007700">, </span><span style="color: #0000BB">$s</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">])) {<br />            if (</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getExternalAttributesIndex</span><span style="color: #007700">(</span><span style="color: #0000BB">$idx</span><span style="color: #007700">, </span><span style="color: #0000BB">$opsys</span><span style="color: #007700">, </span><span style="color: #0000BB">$attr</span><span style="color: #007700">) <br />                &amp;&amp; </span><span style="color: #0000BB">$opsys</span><span style="color: #007700">==</span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">OPSYS_UNIX</span><span style="color: #007700">) {<br />               </span><span style="color: #0000BB">chmod</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">], (</span><span style="color: #0000BB">$attr </span><span style="color: #007700">&gt;&gt; </span><span style="color: #0000BB">16</span><span style="color: #007700">) &amp; </span><span style="color: #0000BB">0777</span><span style="color: #007700">);<br />            }<br />        }<br />    }<br />    </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br />    echo </span><span style="color: #DD0000">"Ok\n"</span><span style="color: #007700">;<br />} else {<br />    echo </span><span style="color: #DD0000">"KO\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </div>

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