/**
* 读取csv文件
* add by huangjt 2013-01-15
*/
public function inputCsv($fileName)
{
$handle = fopen($fileName, 'r');
$out = array ();
$n = 0;
while ($data = fgetcsv($handle, 10000))
{
$n++;
//去掉标题
if($n == 1)
{
continue;
}
$num = count($data);
for ($i = 0; $i < $num; $i++)
{
$out[$n][$i]=iconv('gbk', 'utf-8', $data[$i]);
}
}
fclose($handle);
$len = count($out);
if($len == 0)
{
echo '没有任何数据';
exit();
}
return $out;
}
读取csv格式文件
最新推荐文章于 2022-02-24 16:20:33 发布