读取目录下所有文件的代码,可以不管文件名
复制代码 代码如下:
<?php
$dir = "file";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file!="." && $file!="..") {
echo "<a href=file/".$file.">".$file."</a><br>";
}
}
closedir($dh);
}
}
?>
最后
以上就是怕孤单期待最近收集整理的关于PHP读取目录下所有文件的代码的全部内容,更多相关PHP读取目录下所有文件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复