无法从 Windows 文件系统读取 UTF-8 文件名(主要 Windows 语言为英语)
<?php
$path_to_read = 'D:\music';
class AudioFilterIterator extends FilterIterator
{
public function accept()
{
return (strpos(parent::current(), '.mp3'));
}
}
$object = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path_to_read));
$iterator = new AudioFilterIterator($object);
echo "<pre>";
$files = array();
foreach($iterator as $file)
{
echo $file . "\n";
}
因此,例如,我有一个名为“10 Hort auf.mp3”的文件,但作为输出我得到“10 Hort auf.mp3”
我该如何解决?