Saturday, September 21, 2013

Get .csv file contents using php

$fp = fopen('D:\wamp\www\hmvcExample\img\upload\retest.csv','r') or die("can't open file");
while($csv_line = fgetcsv($fp,1024)) {
    for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
        $csv_line[$i];
    }
$total_data[]=$csv_line;
}
fclose($fp) or die("can't close file");

No comments:

Post a Comment