<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.mkdir.php',
    1 => 'mkdir',
    2 => 'Erstellt ein Verzeichnis',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Dateisystem',
  ),
  'prev' => 
  array (
    0 => 'function.lstat.php',
    1 => 'lstat',
  ),
  'next' => 
  array (
    0 => 'function.move-uploaded-file.php',
    1 => 'move_uploaded_file',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/filesystem/functions/mkdir.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.mkdir" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mkdir</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mkdir</span> &mdash; <span class="dc-title">Erstellt ein Verzeichnis</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mkdir-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mkdir</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$directory</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">$permissions</code><span class="initializer"> = 0777</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$recursive</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></span> <code class="parameter">$context</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Versucht, das durch <code class="parameter">directory</code> angegebene Verzeichnis
   zu erstellen.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mkdir-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">directory</code></dt>
     <dd>
      <p class="para">
       Der Verzeichnispfad.
      </p>
     </dd>
    
    
     <dt><code class="parameter">permissions</code></dt>
     <dd>
      <p class="para">
       Der Zugriffsberechtigungen sind standardmäßig 0777, was den
       größtmöglichen Zugang umfasst. Für weitere Informationen lesen Sie
       bitte die Details auf der <span class="function"><a href="function.chmod.php" class="function">chmod()</a></span>-Seite.
      </p>
      <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
       <p class="para">
        <code class="parameter">permissions</code> wird unter Windows ignoriert.
       </p>
      </p></blockquote>
      <p class="para">
       Beachten Sie, dass Sie <code class="parameter">permissions</code> als oktalen
       Wert angeben sollten, d. h., dass er eine führende Null haben sollte.
       <code class="parameter">permissions</code> wird auch durch das aktuelle umask
       verändert, das Sie mit <span class="function"><a href="function.umask.php" class="function">umask()</a></span> ändern können.
      </p>
     </dd>
    
    
     <dt><code class="parameter">recursive</code></dt>
     <dd>
      <p class="para">
       Falls <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, werden auch die übergeordneten Verzeichnisse des
       angegebenen <code class="parameter">directory</code> erstellt, wobei die
       gleichen Zugriffsrechte gelten.
      </p>
     </dd>
    
    
     <dt><code class="parameter">context</code></dt>
     <dd>
      <p class="para">Eine <a href="stream.contexts.php" class="link">Stream-Kontext</a>-<span class="type"><a href="language.types.resource.php" class="link">Ressource</a></span>.</p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mkdir-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt bei Erfolg <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Wenn das zu erstellende Verzeichnis bereits existiert, wird dies als
    Fehler angesehen und es wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben. Bevor versucht wird,
    ein Verzeichnis zu erstellen, sollte mit <span class="function"><a href="function.is-dir.php" class="function">is_dir()</a></span> oder
    <span class="function"><a href="function.file-exists.php" class="function">file_exists()</a></span> geprüft werden, ob es bereits existiert.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 errors" id="refsect1-function.mkdir-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Gibt einen Fehler der Stufe <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> aus, falls das
   Verzeichnis bereits existiert.
  </p>
  <p class="para">
   Gibt einen Fehler der Stufe <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> aus, falls die
   zugehörigen Berechtigungen verhindern, dass das Verzeichnis erstellt wird.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mkdir-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>mkdir()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />mkdir</span><span style="color: #007700">(</span><span style="color: #DD0000">"/path/to/my/dir"</span><span style="color: #007700">, </span><span style="color: #0000BB">0700</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Beispiel #2 <span class="function"><strong>mkdir()</strong></span> mit dem Parameter <code class="parameter">recursive</code> benutzen</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">// Gewünschte Verzeichnisstruktur<br /></span><span style="color: #0000BB">$structure </span><span style="color: #007700">= </span><span style="color: #DD0000">'./stufe1/stufe2/stufe3/'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Zur Erstellung der verschachtelten Struktur muss der Parameter $recursive<br />// von mkdir() angegeben werden<br /><br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">mkdir</span><span style="color: #007700">(</span><span style="color: #0000BB">$structure</span><span style="color: #007700">, </span><span style="color: #0000BB">0777</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">)) {<br />    die(</span><span style="color: #DD0000">'Erstellung der Verzeichnisse schlug fehl...'</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">// ...<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mkdir-seealso">
  <h3 class="title">Siehe auch</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> - Pr&uuml;ft, ob der angegebene Dateiname ein Verzeichnis ist</span></li>
    <li><span class="function"><a href="function.rmdir.php" class="function" rel="rdfs-seeAlso">rmdir()</a> - L&ouml;scht ein Verzeichnis</span></li>
    <li><span class="function"><a href="function.umask.php" class="function" rel="rdfs-seeAlso">umask()</a> - Changes the current umask</span></li>
   </ul>
  </p>
 </div>


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