【发布时间】:2012-04-17 23:55:47
【问题描述】:
我正在使用 Windows 2003 编写一些 PHP 代码。我使用 XAMPP Portable(复制到 D:)。问题:
$path = 'D:\ebooks';
$all_file = scandir($path);
foreach ($all_file as $file) {
if (is_dir("$path/$file") && $file != '.' && $file != '..') {
echo $file . "<br />\n";
}
}
当我(使用浏览器)调用脚本时,我没有看到任何包含 Unicode 字符的目录(在 D:\ebooks 内)(我用越南语、日语、中文、捷克语进行了测试)。
但如果我删除 is_dir("$path/$file"),目录会显示许多奇怪的字符和许多 ??? 字符。
我该如何解决这个问题?
【问题讨论】:
-
“unicode 名称”是什么意思?你的意思是像Ô或ü这样的特殊字符?
-
“许多奇怪的字符”部分可能与您对浏览器输出的编码有关。
标签: php windows unicode directory