PHP循环列出目录内容代码,一个功能函数。
代码如下:
function list_files($dir)
{
if(is_dir($dir))
{
if($handle = opendir($dir))
{
while(($file = readdir($handle)) !== false)
{
if($file != "." && $file != ".." && $file != "Thumbs.db")
{
echo '
'.$file.''."\n";
}
}
closedir($handle);
}
}
}
这里是摘自脚本之家之前发布的文章。更多的技巧可以参考。
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