CakeFest 2024: The Official CakePHP Conference

closedir

(PHP 4, PHP 5, PHP 7, PHP 8)

closedirDizin tanıtıcısını kapatır

Açıklama

closedir(): void

dizin_tanıtıcısı ile belirtilen dizin akımını kapatır. Akımın evvelce opendir() tarafından açılmış olması gerekir.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Hiçbir değer dönmez.

Sürüm Bilgisi

Sürüm: Açıklama
8.0.0 Artık bağımsız değişken kabul edilmiyor. Evvelce bir dizin tanıtıcısı kabul edilirdi.

Örnekler

Örnek 1 - closedir() örneği

<?php
$dizin
= "/etc/apache2/";

// Dizin aç ve içeriğin oku
if (is_dir($dizin)) {
if (
$dit = opendir($dizin)) {
while ((
$dosya = readdir($dit)) !== false) {
echo
"dosya adı: $dosya - dosya türü: " .
((
filetype($dizin . $dosya) === "dir") ? "dizin" : "dosya") . "\n";
}
closedir();
}
}
?>

add a note

User Contributed Notes 1 note

up
-33
foo at bar dot com
23 years ago
About deleting a directory after doing a readdir/closedir on it... I'm not sure if this is the solution, but you could try to chdir("/"); before the rmdir to make absolutely sure you aren't standing in the directory (i.e trying to pull out the rug from under yourself).
To Top