当前位置:Gxlcms > PHP教程 > php遍历中文目录出现问题

php遍历中文目录出现问题

时间:2021-07-01 10:21:17 帮助过:3人阅读

php

$path= iconv ( "UTF-8", "GBK", $path);
if(!is_dir ( $path )){
echo "你输入的路径不是目录,请检查后重新输入!";
}
$file = opendir ( $path );
while ( $flist = readdir ( $file ) ) {
// 去除.和..
if ($flist == '.' || $flist == '..')
continue;
$filename = $path . '/' . $flist;
$name = iconv ( "GBk", "UTF-8", $filename );
if (is_dir ( $filename )) {
$this->readDir ( $filename );
} else {
$filename = iconv ( "GBk", "UTF-8", $filename );
echo $filename ;
}
}

在win7中可以遍历中文目录,在windows server 2003 输出的是你输入的路径不是目录,请检查后重新输入!
是什么原因

人气教程排行