php readdir() function


  Translation results:

英[ri:d] 美[ri:d]

vt.& vi.Read, read aloud; show; study; understand

vt.read; show; read Understand, understand

n.read; read; read; Reed (name)

adj. to be read aloud; knowledgeable; well-read; knowledgeable

th Third person singular: reads Present participle: reading Past tense: read Past participle: read

php readdir() functionsyntax

Function: Return the file name of the next file in the directory.

Syntax: readdir(dir_handle)

Parameters:

Parameter Description
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: If successful, return the entry name (file name), otherwise return FALSE.

php readdir() functionexample

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

Home

Videos

Q&A