Reading .csv file in php

前端 未结 8 963
面向向阳花
面向向阳花 2020-12-16 15:12

I want to read .csv file in PHP and put its contents into the database. I wrote the following code:

$row = 1;
$file = fopen(\"qryWebsite.csv\", \"r\");
while         


        
8条回答
  •  别那么骄傲
    2020-12-16 15:39

    $fp = fopen('ReadMe.csv','r') or die("can't open file");
    print "\n";
    while($csv_line = fgetcsv($fp,1024)) {
        print '';
        for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
            print '';
        }
        print "\n";
    }
    print '
    '.$csv_line[$i].'
    '; fclose($fp) or die("can't close file");

    More Details

提交回复
热议问题