2 lyq901208 lyq901208 于 2013.07.17 19:39 提问

php遍历中文目录出现问题
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 输出的是你输入的路径不是目录,请检查后重新输入!
是什么原因

Csdn user default icon
上传中...
上传图片
插入图片