知道存在等于部分名称+扩展的文件

时间:2016-05-17 17:47:15

标签: php pattern-matching glob directory-structure file-search

我正在尝试使用过滤器,以查看文件是否存在,以及有多少:我正在尝试使用以下内容来获取脚本:

$list = glob($filepath.$filenamePartial'*'.$ext);
var_dump($list);

解决1:

$list   = glob($filepath.$FsisName.'_'.$count.'_'.'*'.$ext);
if (count($list) <= 0){
        $FFileUPL   = $filepath.$FsisName.'_'.$count.'_'.$FileDate.'.'.$ext;
        $event      =   move_uploaded_file($flTName, $FFileUPL);
    }else{
        echo 'this file Exist: '.$FsisName.'-'.$count.'-'.$FileDate.'.'.$ext.'<br>';
        $event  =   false;
    }

如何在iteratos中检索名称文件? 解决2:

foreach($list as $fnames){
    $eFile['smg']       .= basename($fnames).'<br>';
}

1 个答案:

答案 0 :(得分:0)

解决:

$list   = glob($filepath.$FsisName.'_'.$count.'_'.'*'.$ext);
if (count($list) <= 0){
        $FFileUPL   = $filepath.$FsisName.'_'.$count.'_'.$FileDate.'.'.$ext;
        $event      =   move_uploaded_file($flTName, $FFileUPL);
    }else{
        echo 'this file Exist: '.$FsisName.'-'.$count.'-'.$FileDate.'.'.$ext.'<br>';
        $event  =   false;
    }
foreach($list as $fnames){
    $eFile['smg']       .= basename($fnames).'<br>';
}