public function readFile($path){
$data = array();
$returnTxt = ‘‘; // 初始化返回
$i = 1;
$fh = fopen($path,"r");
while (!feof($fh)){
$line = fgets($fh, 4096);
if($i>=3 && !empty($line)){
$returnTxt = $line;
$str = iconv(‘GB2312‘,‘UTF-8‘,$returnTxt);
$arr = explode(‘,‘,$str);
$data[] = $arr;
}
$i++;
}
fclose($fh);
}
$path="文件路径";
readFile($path);
原文地址:https://www.cnblogs.com/lsbaiwyl/p/9020041.html
时间: 2024-10-04 03:51:36