<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.dir.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.opendir.php',
    1 => 'opendir',
    2 => 'Apre l\'handle della directory',
  ),
  'up' => 
  array (
    0 => 'ref.dir.php',
    1 => 'Directory Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.getcwd.php',
    1 => 'getcwd',
  ),
  'next' => 
  array (
    0 => 'function.readdir.php',
    1 => 'readdir',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/dir/functions/opendir.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.opendir" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">opendir</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">opendir</span> &mdash; <span class="dc-title">Apre l&#039;handle della directory</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.opendir-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>opendir</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>, <span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$context</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></div>

  <p class="para rdfs-comment">
   Restituisce un handle della directory da usare nelle chiamate alle funzioni
   <span class="function"><a href="function.closedir.php" class="function">closedir()</a></span>, <span class="function"><a href="function.readdir.php" class="function">readdir()</a></span> e
   <span class="function"><a href="function.rewinddir.php" class="function">rewinddir()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.opendir-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       Il percorso della cartella da aprire
      </p>
     </dd>
    
    
     <dt><code class="parameter">context</code></dt>
     <dd>
      <p class="para">
       Per una descrizione del parametro <code class="parameter">context</code>,
       fare riferimento a <a href="ref.stream.php" class="link">la sezione sugli stream</a> del
       manuale.
      </p> 
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.opendir-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Restituisce, in caso di successo, un <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> puntatore a una cartella, oppure
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
  </p> 
  <p class="para">
   Se <code class="parameter">path</code> non è una directory valida o la
   directory non può essere aperta a causa di restrizioni sui permessi di accesso o
   a causa di errori del filesystem, <span class="function"><strong>opendir()</strong></span> restituisce <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> e
   genera un errore PHP di tipo <a href="errorfunc.constants.php" class="link">
   E_WARNING</a>. Si può sopprimere l&#039;output dell&#039;errore di
   <span class="function"><strong>opendir()</strong></span> anteponendo
   &#039;<a href="language.operators.errorcontrol.php" class="link">@</a>&#039; al nome della
   funzione.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.opendir-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Versione</th>
       <th>Descrizione</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.0.0</td>
       <td>
        <code class="parameter">path</code> accetta il wrapper URL <code class="literal">ftp://</code> 
        .
       </td>
      </tr>

      <tr>
       <td>4.3.0</td>
       <td>
        <code class="parameter">path</code> può anche essere qualsiasi URL che supporti
        l&#039;elencazione del contenuto delle cartelle; comunque solo il wrapper URL <code class="literal">file://</code>
        lo supporta in PHP 4
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.opendir-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 esempio <span class="function"><strong>opendir()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$dir </span><span style="color: #007700">= </span><span style="color: #DD0000">"/etc/php5/"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Open a known directory, and proceed to read its contents<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">is_dir</span><span style="color: #007700">(</span><span style="color: #0000BB">$dir</span><span style="color: #007700">)) {<br />    if (</span><span style="color: #0000BB">$dh </span><span style="color: #007700">= </span><span style="color: #0000BB">opendir</span><span style="color: #007700">(</span><span style="color: #0000BB">$dir</span><span style="color: #007700">)) {<br />        while ((</span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">readdir</span><span style="color: #007700">(</span><span style="color: #0000BB">$dh</span><span style="color: #007700">)) !== </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br />            echo </span><span style="color: #DD0000">"filename: </span><span style="color: #0000BB">$file</span><span style="color: #DD0000"> : filetype: " </span><span style="color: #007700">. </span><span style="color: #0000BB">filetype</span><span style="color: #007700">(</span><span style="color: #0000BB">$dir </span><span style="color: #007700">. </span><span style="color: #0000BB">$file</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />        }<br />        </span><span style="color: #0000BB">closedir</span><span style="color: #007700">(</span><span style="color: #0000BB">$dh</span><span style="color: #007700">);<br />    }<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà
qualcosa simile a:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">filename: . : filetype: dir
filename: .. : filetype: dir
filename: apache : filetype: dir
filename: cgi : filetype: dir
filename: cli : filetype: dir</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.opendir-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.is-dir.php" class="function" rel="rdfs-seeAlso">is_dir()</a> - Dice se la stringa corrisponde ad una directory</span></li>
    <li><span class="function"><a href="function.readdir.php" class="function" rel="rdfs-seeAlso">readdir()</a> - Legge una voce dall'handle della directory</span></li>
    <li><span class="function"><a href="function.dir.php" class="function" rel="rdfs-seeAlso">dir()</a> - Return an instance of the Directory class</span></li>
   </ul>
  </p>
 </div>

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