0

我有一个非常长的 csv 文件,其中包含数十列和数千行。我需要使用 php 仅从该 csv 获取有关特定数据的信息。

csv 文件位于:http ://www.ezmedia2u.com/software/hworiginal.csv 。

我想要获取的数据样本是从第 1203 行到第 1275 行,“整个页面”,我需要以表格格式显示。

4

1 回答 1

0

if you want to fetch data from csv file try this.

<?php
     $fp = fopen('test.csv','r') or die("can't open file");
     print "<table>\n";
     while($csv_line = fgetcsv($fp,1024)) {
       print '<tr>';
       for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
         print '<td>'.$csv_line[$i].'</td>';
       }
       print "</tr>\n";
     }
     print '</table>\n';
     fclose($fp) or die("can't close file");
?>
于 2013-02-14T05:03:41.473 回答