时间:2021-07-01 10:21:17 帮助过:2人阅读
array(6) {
[0]=>
string(62) "../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020.csv"
[1]=>
string(64) "../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_1.csv"
[2]=>
string(64) "../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_2.csv"
[3]=>
string(64) "../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_3.csv"
[4]=>
string(64) "../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_4.csv"
[5]=>
string(65) "../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_NG.csv"
}
$arr=array(
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020.csv",
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_1.csv",
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_2.csv",
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_3.csv",
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_4.csv",
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7020_NG.csv",
"../../dat/DIG/TestFunction/TS407/BED410-500A1/5306/NG/7021_NG.csv",//添加测试
);
foreach($arr as $v){
$tmp=explode('/',$v);
$lastfile=array_pop($tmp);
preg_match('/^(\d+)(\.
------解决思路----------------------
\_)/',$lastfile,$m);
$arr_file[]=$m[1];
}
$count=count(array_unique($arr_file));
echo $count;//2