How to extract data from csv file in PHP

前端 未结 11 1576
醉酒成梦
醉酒成梦 2020-11-22 07:36

I have a csv file which looks like this

$lines[0] = \"text, with commas\", \"another text\", 123, \"text\",5;
$lines[1] = \"some without commas\", \"another          


        
11条回答
  •  天命终不由人
    2020-11-22 08:12

    you can read the data using the following function.

      function readCSV() {
        $csv = array_map('str_getcsv', file('data.csv'));
        array_shift($csv); //remove headers
    
    
    }
    

    http://www.pearlbells.co.uk/how-to-sort-a1a2-z9z10aa1aa2-az9az10-using-php/

提交回复
热议问题