Php 如何检查根目录的任何一个文件夹中是否存在文件

Php 如何检查根目录的任何一个文件夹中是否存在文件,php,Php,我有一个根目录(probeta)。在这个目录中,我又有3个子文件夹,如hr、admin、super。如何检查这3个文件夹中是否存在文件 我试过这个代码..但它总是转到'super/notifications/filename`` <?php $dir="../super/notifications/"; $dir1="../admin/notifications/"; if(file_exists($dir. $row['file'])) { ?&

我有一个根目录(probeta)。在这个目录中,我又有3个子文件夹,如
hr、admin、super
。如何检查这3个文件夹中是否存在文件

我试过这个代码..但它总是转到'super/notifications/filename``

<?php
$dir="../super/notifications/";
$dir1="../admin/notifications/";


if(file_exists($dir. $row['file']))
{       
            ?>
         <a href='../super/notifications/<?php echo $row['file']; ?>' target='_blank' >View Details</a>
<?php
}
else if(file_exists($dir1. $row['file']))
{       
            ?>
         <a href='../admin/notifications/<?php echo $row['file']; ?>' target='_blank' >View Details</a>
<?php
}
else 
{       
            ?>
         <a href='../hr/notifications/<?php echo $row['file']; ?>' target='_blank' >View Details</a>
<?php
}
?>

//请帮帮我。。。
当一个文件上传到数据库时,有没有办法将文件存储到3个文件夹中???

检查if语句中的所有条件

<?php
$dir="../super/notifications/";
$dir1="../admin/notifications/";
$dir2="../hr/notifications/";
if(file_exists($dir. $row['file'])|| file_exists($dir2. $row['file']) || file_exists($dir2. $row['file']))
{      ?>
 <a href='<?php if(file_exists($dir. $row['file'])) echo $dir;else if(file_exists($dir1. $row['file'])) echo $dir1;else if(file_exists($dir2. $row['file'])) echo $dir2;?>/<?php $row['file']; ?>' target='_blank' >View Details</a>


如果文件存在于这三个路径中的一个路径中,它只会转到..super/notifications/。但我想转到相应的文件夹…例如,如果文件存在于../hr/notifications/,则a href类似../hr/notifications/。它不起作用..它显示如下。。。probeta/employee/$dir/remo'',并将其设为adsecho$dir