Home >php教程 >php手册 >php如何获取文件夹名字

php如何获取文件夹名字

WBOY
WBOYOriginal
2016-06-21 08:56:522005browse

php如何获取文件夹名字

php如何获取文件夹名字其实很简单,只要记住一两个函数就可以了!


$dir = "message/";  // 文件夹的名称

if (is_dir($dir)){
    if ($dh = opendir($dir)){
        while (($file = readdir($dh)) !== false){
            echo "文件名: $file
";
        }
        closedir($dh);
    }
}
 



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn