now you need to traverse the number of files in the folder, then read the contents of the files separately, and then determine whether each line meets the requirements, and then output all the contents of the files that meet the requirements. Now and strangely, I can read one by one, but only the 4th and 47th files will be read at one time, and the other files will not be displayed (a total of 1002 files), nor will they report an error. The code is as follows
<?php
header("Content-type: text/html; charset=utf-8");
//
$list = scandir("./1534258683");
$listNum = count($list);
for($i = 2; $i < $listNum; $iPP){ //$i$i = 2; $i < 3; $iPP
$file_path = "./1534258683/".$list[$i];
echo ":".str_replace(".csv","",$list[$i])."[$i]<br/>================<br/>";
if(file_exists($file_path)){
$file_arr = file($file_path);
//echo iconv("gb2312", "utf-8", $file_arr[5]);
for($i=1;$i<count($file_arr);$iPP){ //
$keyWordsIndexNum = str_replace(",","",strstr($file_arr[$i],","));
if($keyWordsIndexNum > 0) {
echo iconv("gb2312", "utf-8", $file_arr[$i])."<br />";
}
//echo iconv("gb2312", "utf-8", $file_arr[$i])."<br /><br />";
}
}
echo "<br />";
}
the content of the file in each csv is similar to the following structure. Extract the number greater than 0 after each line of comma in each csv file
,695
,383
,330
,203
,146