好的,所以我要做的是扫描“上一个”文件夹。
$scanned = scandir("..");
foreach($scanned as $file){
if(is_file($file)){
print $file."<br />";
}
}
即使在我的“..”目录中我有 20 多个文件,我只得到三行
index.jpg
index.php
template.dtd
我注意到,如果我不使用该 is_file if 子句,它将返回所有文件名;但我真的需要那个 if 子句。