在php手册里面有这样一个例子,为什么读出的是乱码
<?php
$row = 1;
$handle = fopen("test.csv","r");
while ($data = fgetcsv($handle, 1000, ",")) {
$num = count($data);
echo "<p> $num fields in line $row: <br> ";
$row++;
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br> ";
}
}
fclose($handle);
?>
解决方法:把CSV文件另存为UTF-8的格式就可以了。