php closedir() function


  Translation results:

英[kləʊz] 美[kloʊz]

adj.Intimate; close; close

vt. Close; end; make close

vi. Close ;off; end

adv.closely

n.End

Third person singular: closes Present participle: closing Past tense: closed Past participle: closed Comparative: closer Superlative: closest

php closedir() functionsyntax

Function: Close the directory handle.

Syntax: closedir(dir_handle);

Parameters:

ParameterDescription
dir_handle Optional. Specifies a directory handle resource previously opened by opendir(). If this parameter is not specified, the last link opened by opendir() is used.

Description: Close the directory handle.

php closedir() functionexample

<?php
$dir = "/phpstudy/WWW/20180414/";
// 打开目录,然后读取其内容
if ($dh = opendir($dir)){
        while (($file = readdir($dh)) !== false)
        {
            echo "filename:" . $file . "<br>";
        }
        closedir($dh);
}
?>

Home

Videos

Q&A