<?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 => 'de',
  ),
  'this' => 
  array (
    0 => 'ziparchive.locatename.php',
    1 => 'ZipArchive::locateName',
    2 => 'Gibt den Index eines Archiveintrags zur&uuml;ck',
  ),
  'up' => 
  array (
    0 => 'class.ziparchive.php',
    1 => 'ZipArchive',
  ),
  'prev' => 
  array (
    0 => 'ziparchive.isencryptionmethoddupported.php',
    1 => 'ZipArchive::isEncryptionMethodSupported',
  ),
  'next' => 
  array (
    0 => 'ziparchive.open.php',
    1 => 'ZipArchive::open',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/zip/ziparchive/locatename.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ziparchive.locatename" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ZipArchive::locateName</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.5.0)</p><p class="refpurpose"><span class="refname">ZipArchive::locateName</span> &mdash; <span class="dc-title">Gibt den Index eines Archiveintrags zurück</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-ziparchive.locatename-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ZipArchive::locateName</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>, <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>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Lokalisiert einen Eintrag unter Verwendung seines Namens.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-ziparchive.locatename-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">name</code></dt>
     <dd>
      <p class="para">
       Der Name des Eintrags, nach dem gesucht werden soll.
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       Die Funktion gibt den Index der Datei namens fname im Archiv zurück.
       Die Flags können miteinander kombiniert werden, soll keines davon
       genutzt werden, sollte 0 verwendet werden.
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <strong><code><a href="zip.constants.php#ziparchive.constants.fl-nocase">ZipArchive::FL_NOCASE</a></code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="zip.constants.php#ziparchive.constants.fl-nodir">ZipArchive::FL_NODIR</a></code></strong>
         </p>
        </li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-ziparchive.locatename-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt im Erfolgsfall den Index eines Eintrags zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-ziparchive.locatename-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 Ein Archiv erstellen und es mit locateName verwenden</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= </span><span style="color: #DD0000">'testlocate.zip'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$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: #0000BB">$file</span><span style="color: #007700">, </span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">CREATE</span><span style="color: #007700">) !== </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">) {<br />    exit(</span><span style="color: #DD0000">'Fehler'</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addFromString</span><span style="color: #007700">(</span><span style="color: #DD0000">'eintrag1.txt'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Eintrag #1'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addFromString</span><span style="color: #007700">(</span><span style="color: #DD0000">'eintrag2.txt'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Eintrag #2'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addFromString</span><span style="color: #007700">(</span><span style="color: #DD0000">'dir/eintrag2d.txt'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Eintrag #2'</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">status </span><span style="color: #007700">== </span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">ER_OK</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"Fehler beim Schreiben des ZIP\n"</span><span style="color: #007700">;<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 /><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: #0000BB">$file</span><span style="color: #007700">) !== </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">) {<br />    exit(</span><span style="color: #DD0000">'Fehler'</span><span style="color: #007700">);<br />}<br /><br />echo </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">locateName</span><span style="color: #007700">(</span><span style="color: #DD0000">'eintrag1.txt'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">locateName</span><span style="color: #007700">(</span><span style="color: #DD0000">'eiNtrag2.txt'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">locateName</span><span style="color: #007700">(</span><span style="color: #DD0000">'eiNtrag2.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">FL_NOCASE</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">locateName</span><span style="color: #007700">(</span><span style="color: #DD0000">'einTRag2d.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">FL_NOCASE</span><span style="color: #007700">|</span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">FL_NODIR</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<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 /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">0

1
2</pre>
</div>
   </div>
  </div>
 </div>


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