2017-07-14 114 views
0

我正试图读取csv文件中只带有红色标签的列。有没有一个PHP函数来做到这一点或symfony包? 现在我在读csv文件与fgetcsv功能:从PHP读取csv列的颜色

foreach($request->files->get('importFile') as $file) { 
    if (($handle = fopen($file->getRealPath(), "r")) !== FALSE) { 
     // get the rest of the rows 
     $data = array(); 
     $i = 0; 
     while ($row = fgetcsv($handle, 0, ';')) { 
      if($i>1) { 
       $data[] = $row; 
       $i++; 
      } 

      print_r($data);die; 

     } 
    } 
} 

但它不读取标签的color.Is有没有办法读了CSV文件中的颜色?

+3

您不能在csv中设置任何行的颜色,因为csv只是基于文本的 –

回答

2

CSV文件没有格式。

.xls.odt文件有格式,但CSV绝对不是 - 只有数据保存在那里。用文本编辑器查看文件。