TIA。凭借我的 PHP 补救技能,我无法弄清楚为什么 scandir 不能按字母顺序自动排序。(将文件夹组合在一起并按字母顺序排序以及将文件组合在一起并按字母顺序排序也很好,但这并不重要。)我错过了什么?
<?php
$dir = './customers/' . $customer . "/";
$exclude = array(".","..",".htaccess");
    if (is_dir($dir)) {
        $files = scandir($dir);
        foreach($files as $key=>$dir){
            if(!in_array($dir, $exclude)){
    echo ("<a href=\"./customers/$customer/".$dir."\">".$dir."</a><br>");
        }
    }
}
?>
Run Code Online (Sandbox Code Playgroud)