复制代码 代码如下:
//PHP遍历文件夹下所有文件
$handle=opendir('C:\\'); //我要遍历C盘的文件
echo "目录 handle: $handle
";
echo "文件:
";
while ($file =readdir($handle)) {
$file=iconv('GB2312','UTF-8',$file);//将XP的gbk编码转成UTF8
echo "$file
"; //输出文件名
}
closedir($handle);
?>
Statement of this Website
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