我在這裏是新的,我想獲得CSV的特定行,但實際上無法得到它,希望有人可以幫助我。CSV顯示特定行
以下是我的CSV示例。
Aaron, Male, [email protected]
Arianne, Female, [email protected]
Bea, Female, [email protected]
Carlos, Male, [email protected]
Drake, Male, [email protected]
Delilah, Female, [email protected]
Erica, Female, [email protected]
Flint, Male, [email protected]
我想只在我的文件中顯示從德雷克到艾瑞卡的一行。
這裏是我的代碼
<?php
echo "<html><body><table BORDER=1, WIDTH=1200px>\n\n";
$f = fopen("Senter code hereample.csv", "r");
while (($line = fgetcsv($f)) !== false){
echo "<tr>";
foreach ($line as $cell) {
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
}`enter code here
fclose($f);
echo "\n</table></body></html>";
?>
單行:'$ line [number_here]'。 – PHPglue 2014-08-28 02:10:12
需要一個數組去除引用(假設PHP 5.4+)調用'fgetcsv($ f)[number_here]'。 '$ line'只是循環中的一個指針。 – 2014-08-28 02:19:23