Home > Backend Development > PHP Tutorial > php遍历中文目录出现问题

php遍历中文目录出现问题

WBOY
Release: 2016-06-02 11:34:49
Original
1109 people have browsed it

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 输出的是你输入的路径不是目录,请检查后重新输入!
是什么原因

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template