<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.rararchive.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'tr',
  ),
  'this' => 
  array (
    0 => 'rararchive.open.php',
    1 => 'RarArchive::open',
    2 => 'Open RAR archive',
  ),
  'up' => 
  array (
    0 => 'class.rararchive.php',
    1 => 'RarArchive',
  ),
  'prev' => 
  array (
    0 => 'rararchive.issolid.php',
    1 => 'RarArchive::isSolid',
  ),
  'next' => 
  array (
    0 => 'rararchive.setallowbroken.php',
    1 => 'RarArchive::setAllowBroken',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/rar/rararchive/open.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="rararchive.open" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">RarArchive::open</h1>
  <h1 class="refname">rar_open</h1>
  <p class="verinfo">(PECL rar &gt;= 2.0.0)</p><p class="refpurpose"><span class="refname">RarArchive::open</span> -- <span class="refname">rar_open</span> &mdash; <span class="dc-title">Open RAR archive</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-rararchive.open-description">
  <h3 class="title">Açıklama</h3>
  <p class="simpara">Nesne yönelimli kullanım (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>RarArchive::open</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$password</code><span class="initializer"> = NULL</span></span>, <span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$volume_callback</code><span class="initializer"> = NULL</span></span>): <span class="type"><span class="type"><a href="class.rararchive.php" class="type RarArchive">RarArchive</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">Yordamsal kullanım:</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>rar_open</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$password</code><span class="initializer"> = NULL</span></span>, <span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$volume_callback</code><span class="initializer"> = NULL</span></span>): <span class="type"><span class="type"><a href="class.rararchive.php" class="type RarArchive">RarArchive</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   Open specified RAR archive and return <span class="type"><a href="class.rararchive.php" class="type RarArchive">RarArchive</a></span> instance representing it.
  </p>
  <blockquote class="note"><p><strong class="note">Bilginize</strong>: 
   <span class="simpara">
    If opening a multi-volume archive, the path of the first volume should be passed as the first parameter.
    Otherwise, not all files will be shown. This is by design.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-rararchive.open-parameters">
  <h3 class="title">Bağımsız Değişkenler</h3>
  <dl>
   
    <dt><code class="parameter">filename</code></dt>
    <dd>
     <span class="simpara">
      Path to the Rar archive.
     </span>
    </dd>
   
   
    <dt><code class="parameter">password</code></dt>
    <dd>
     <span class="simpara">
      A plain password, if needed to decrypt the headers. It will also be used by default
      if encrypted files are found. Note that the files may have
      different passwords in respect to the headers and among them.
     </span>
    </dd>
   
   
    <dt><code class="parameter">volume_callback</code></dt>
    <dd>
     <span class="simpara">
      A function that receives one parameter – the path of the volume
      that was not found – and returns a string with the correct path
      for such volume or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> if such volume does
      not exist or is not known. The programmer should ensure the
      passed function doesn&#039;t cause loops as this function is called
      repeatedly if the path returned in a previous call did not
      correspond to the needed volume. Specifying this parameter omits
      the notice that would otherwise be emitted whenever a volume is
      not found; an implementation that only returns <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>
      can therefore be used to merely omit such notices.
     </span>
    </dd>
   
  </dl>
  <div class="warning"><strong class="warning">Uyarı</strong>
   <p class="simpara">
    Prior to version 2.0.0, this function would not handle relative
    paths correctly. Use <span class="function"><a href="function.realpath.php" class="function">realpath()</a></span> as a workaround.
   </p>
  </div>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-rararchive.open-returnvalues">
  <h3 class="title">Dönen Değerler</h3>
  <p class="simpara">
   Returns the requested <span class="type"><a href="class.rararchive.php" class="type RarArchive">RarArchive</a></span> instance  başarısızlık durumunda <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> döner.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-rararchive.open-changelog">
  <h3 class="title">Sürüm Bilgisi</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Sürüm: </th>
      <th>Açıklama</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL rar 3.0.0</td>
      <td>
       <code class="parameter">volume_callback</code> was added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-rararchive.open-examples">
  <h3 class="title">Örnekler</h3>
  <div class="example" id="example-1">
   <p><strong>Örnek 1 Nesne yönelimli kullanım</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$rar_arch </span><span style="color: #007700">= </span><span style="color: #0000BB">RarArchive</span><span style="color: #007700">::</span><span style="color: #0000BB">open</span><span style="color: #007700">(</span><span style="color: #DD0000">'encrypted_headers.rar'</span><span style="color: #007700">, </span><span style="color: #DD0000">'samplepassword'</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$rar_arch </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />    die(</span><span style="color: #DD0000">"Failed opening file"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$entries </span><span style="color: #007700">= </span><span style="color: #0000BB">$rar_arch</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getEntries</span><span style="color: #007700">();<br />if (</span><span style="color: #0000BB">$entries </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />    die(</span><span style="color: #DD0000">"Failed fetching entries"</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"Found " </span><span style="color: #007700">. </span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$entries</span><span style="color: #007700">) . </span><span style="color: #DD0000">" files.\n"</span><span style="color: #007700">;<br /><br />if (empty(</span><span style="color: #0000BB">$entries</span><span style="color: #007700">))<br />    die(</span><span style="color: #DD0000">"No valid entries found."</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stream </span><span style="color: #007700">= </span><span style="color: #0000BB">reset</span><span style="color: #007700">(</span><span style="color: #0000BB">$entries</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getStream</span><span style="color: #007700">();<br />if (</span><span style="color: #0000BB">$stream </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />    die(</span><span style="color: #DD0000">"Failed opening first file"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$rar_arch</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"Content of first one follows:\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">stream_get_contents</span><span style="color: #007700">(</span><span style="color: #0000BB">$stream</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$stream</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>
Yukarıdaki örnek şuna benzer bir çıktı üretir:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Found 2 files.
Content of first one follows:
Encrypted file 1 contents.</pre>
</div>
   </div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Örnek 2 Yordamsal kullanım</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$rar_arch </span><span style="color: #007700">= </span><span style="color: #0000BB">rar_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'encrypted_headers.rar'</span><span style="color: #007700">, </span><span style="color: #DD0000">'samplepassword'</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$rar_arch </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />    die(</span><span style="color: #DD0000">"Failed opening file"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$entries </span><span style="color: #007700">= </span><span style="color: #0000BB">rar_list</span><span style="color: #007700">(</span><span style="color: #0000BB">$rar_arch</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$entries </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />    die(</span><span style="color: #DD0000">"Failed fetching entries"</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"Found " </span><span style="color: #007700">. </span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$entries</span><span style="color: #007700">) . </span><span style="color: #DD0000">" files.\n"</span><span style="color: #007700">;<br /><br />if (empty(</span><span style="color: #0000BB">$entries</span><span style="color: #007700">))<br />    die(</span><span style="color: #DD0000">"No valid entries found."</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stream </span><span style="color: #007700">= </span><span style="color: #0000BB">reset</span><span style="color: #007700">(</span><span style="color: #0000BB">$entries</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">getStream</span><span style="color: #007700">();<br />if (</span><span style="color: #0000BB">$stream </span><span style="color: #007700">=== </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">)<br />    die(</span><span style="color: #DD0000">"Failed opening first file"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">rar_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$rar_arch</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"Content of first one follows:\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">stream_get_contents</span><span style="color: #007700">(</span><span style="color: #0000BB">$stream</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$stream</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

  </div>
  <div class="example" id="example-3">
   <p><strong>Örnek 3 Volume Callback</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/* In this example, there's a volume named multi_broken.part1.rar<br /> * whose next volume is named multi.part2.rar */<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">resolve</span><span style="color: #007700">(</span><span style="color: #0000BB">$vol</span><span style="color: #007700">) {<br />    if (</span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">'/_broken/'</span><span style="color: #007700">, </span><span style="color: #0000BB">$vol</span><span style="color: #007700">))<br />        return </span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'_broken'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">, </span><span style="color: #0000BB">$vol</span><span style="color: #007700">);<br />    else<br />        return </span><span style="color: #0000BB">null</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">$rar_file1 </span><span style="color: #007700">= </span><span style="color: #0000BB">rar_open</span><span style="color: #007700">(</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">).</span><span style="color: #DD0000">'/multi_broken.part1.rar'</span><span style="color: #007700">, </span><span style="color: #0000BB">null</span><span style="color: #007700">, </span><span style="color: #DD0000">'resolve'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$entry </span><span style="color: #007700">= </span><span style="color: #0000BB">$rar_file1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getEntry</span><span style="color: #007700">(</span><span style="color: #DD0000">'file2.txt'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$entry</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">extract</span><span style="color: #007700">(</span><span style="color: #0000BB">null</span><span style="color: #007700">, </span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">) . </span><span style="color: #DD0000">"/temp_file2.txt"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-rararchive.open-seealso">
  <h3 class="title">Ayrıca Bakınız</h3>
  <ul class="simplelist">
   <li><a href="wrappers.rar.php" class="link"><code class="literal">rar://</code> wrapper</a></li>
  </ul>
 </div>



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