-
-
//设置UTF-8编码 - setlocale(LC_ALL, 'en_US.UTF-8');
- //csv路径
- $csv_file = "csv/excel.csv";
- //以只读方式打开文件
- $handle = fopen($csv_file, "r");
- //定义结果数组
- $listarr = array();
- //打开csv中一行,并用","分割为数组
- while($data = fgetcsv($handle, 1000, ",")){
- $num = count($data);
- for($i=0; $i<$num; $i ){
- $data[$i] = mb_convert_encoding($data[$i],"UTF-8","UTF-8");
- }// bbs.it-home.org
- $listarr[] = $data;
- }
return $listarr;
-
复制代码
>>> 更多有关php 生成(导出)csv的内容。 |