📜  php 读取 csv - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:39.452000             🧑  作者: Mango

代码示例4
$row = 1;
if (($handle = fopen("test.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "

$num fields in line $row:

\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "
\n"; } } fclose($handle); }