mirror of
https://github.com/php/doc-ja.git
synced 2026-03-28 09:02:14 +01:00
177 lines
5.2 KiB
XML
177 lines
5.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 6b48028aef8211f89ae6c9fefe64177de2f86e12 Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: elf,shimooka,mumumu -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.mkdir">
|
|
<refnamediv>
|
|
<refname>mkdir</refname>
|
|
<refpurpose>ディレクトリを作る</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>mkdir</methodname>
|
|
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>permissions</parameter><initializer>0777</initializer></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>recursive</parameter><initializer>&false;</initializer></methodparam>
|
|
<methodparam choice="opt"><type class="union"><type>resource</type><type>null</type></type><parameter>context</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<parameter>directory</parameter> で指定したディレクトリを作成します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>directory</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
ディレクトリのパス。
|
|
&tip.fopen-wrapper;
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>permissions</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
パーミッションは 0777 がデフォルトです。
|
|
これは最も緩やかなアクセス制限を意味します。
|
|
パーミッションに関する詳細は <function>chmod</function> をご覧ください。
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Windows では <parameter>permissions</parameter> は無視されます。
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<parameter>permissions</parameter> を八進数で指定したくなることもあるかもしれません。
|
|
その場合は先頭にゼロをつける必要があります。
|
|
また <parameter>permissions</parameter> は、
|
|
現在設定されている umask の影響も受けます。
|
|
umask を変更するには <function>umask</function> を使用します。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>recursive</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
&true; を指定すると、
|
|
<parameter>directory</parameter>
|
|
で指定されたディレクトリの、
|
|
全ての親ディレクトリも同じパーミッションで作成されます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>context</parameter></term>
|
|
<listitem>
|
|
¬e.context-support;
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
<note>
|
|
<para>
|
|
作成しようとしたディレクトリが既に存在している場合、
|
|
エラーとみなされ、&false; が返されます。
|
|
作成しようとする前に、既にディレクトリが存在するかをチェックするには
|
|
<function>is_dir</function> や <function>file_exists</function>
|
|
を使ってください。
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
ディレクトリが既に存在する場合は <constant>E_WARNING</constant> レベルのエラーが発生します。
|
|
</para>
|
|
<para>
|
|
ディレクトリの作成権限がない場合は <constant>E_WARNING</constant> レベルのエラーが発生します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>mkdir</function> の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
mkdir("/path/to/my/dir", 0700);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>mkdir</function> での <parameter>recursive</parameter> パラメータの使用例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// 作りたいディレクトリ構造
|
|
$structure = './depth1/depth2/depth3/';
|
|
|
|
// 入れ子構造を作るには、$recursive パラメータを
|
|
// mkdir() に指定しなければなりません
|
|
|
|
if (!mkdir($structure, 0777, true)) {
|
|
die('Failed to create directories...');
|
|
}
|
|
|
|
// ...
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>rmdir</function></member>
|
|
<member><function>umask</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|