पीएचपी क्लोजर () फंक्शन
उदाहरण
एक निर्देशिका खोलें, उसकी सामग्री पढ़ें, फिर बंद करें:
<?php
$dir = "/images/";
// Open a directory, and read its contents
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($file = readdir($dh)) !== false){
echo "filename:" . $file . "<br>";
}
closedir($dh);
}
}
?>
परिणाम:
filename: cat.gif
filename: dog.gif
filename: horse.gif
परिभाषा और उपयोग
क्लोजर () फ़ंक्शन एक निर्देशिका हैंडल को बंद कर देता है।
वाक्य - विन्यास
closedir(dir)
पैरामीटर मान
Parameter | Description |
---|---|
dir | Optional. Specifies the directory handle resource previously opened with opendir(). If this parameter is not specified, the last link opened by opendir() is assumed |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | - |
---|---|
पीएचपी संस्करण: | 4.0+ |
पीएचपी निर्देशिका संदर्भ