PHP 遍历XP文件夹下所有文件
2018-09-07 17:33
阅读:319
复制代码 代码如下:
<meta http-equiv=Content-Type content=text/html; charset=utf-8 />
<?php
//PHP遍历文件夹下所有文件
$handle=opendir(C:\\); //我要遍历C盘的文件
echo 目录 handle: $handle <br/>;
echo 文件: <br/>;
while ($file =readdir($handle)) {
$file=iconv(GB2312,UTF-8,$file);//将XP的gbk编码转成UTF8
echo $file <br/>; //输出文件名
}
closedir($handle);
?>
上一篇:php输出含有“#”字符串的方法
下一篇:PHP 编写的 25个游戏脚本
评论
亲,登录后才可以留言!