array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.is-dir.php', 1 => 'is_dir', 2 => 'Tells whether the filename is a directory', ), 'up' => array ( 0 => 'ref.filesystem.php', 1 => 'Функції Файлової Системи', ), 'prev' => array ( 0 => 'function.glob.php', 1 => 'glob', ), 'next' => array ( 0 => 'function.is-executable.php', 1 => 'is_executable', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/filesystem/functions/is-dir.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
is_dir — Tells whether the filename is a directory
filename
Path to the file. If filename
is a relative
filename, it will be checked relative to the current working
directory. If filename
is a symbolic or hard link
then the link will be resolved and checked. If you have enabled
open_basedir further
restrictions may apply.
Під час збоїв буде видаватись E_WARNING
.
Приклад #1 is_dir() example
<?php
var_dump(is_dir('a_file.txt'));
var_dump(is_dir('bogus_dir/abc'));
var_dump(is_dir('..')); //one dir up
?>
Поданий вище приклад виведе:
bool(false) bool(false) bool(true)
Зауваження: Рузультати цієї функції кешуються. Докладніше: clearstatcache().
Починаючи з PHP 5.0.0, ця функція також може бути використана з деякими URL-обгортками. На сторінці Підтримувані протоколи та обгортки вказано, які обгортки підтримують сімейство функцій stat().