本篇文章是对使用php将某个目录下面的所有文件罗列出来的方法进行了详细的分析介绍,需要的朋友参考下
直接给源代码了:
复制代码 代码如下:
$current_dir = 'E:/temp/';
$dir = opendir($current_dir);
echo "direcotry list:
";
while(false !== ($file=readdir($dir))){
if($file != "." && $file != ".."){
echo "- $file
";
}
}
echo "
";
closedir($dir);
如果跟web是同一个盘符,香港服务器租用,网站空间,香港空间,就直接写:$current_dir='/temp/';就可以了。
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