是否可以将opendir按字母顺序排序?
$user = $fgmembersite->UserFullName();
$handle = opendir("users/$user/");
while (false!==($file = readdir($handle))) {
if ($file != "." && $file != ".."){
echo 'some code here';
}
}
提前致谢!
答案 0 :(得分:6)
我会改用scandir()
:
$user = $fgmembersite->UserFullName();
$files = scandir('users/' . $user . '/');
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
// Do stuff here
}
}
正如Blauesocke指出的那样,它已经分类了。