1 回答

TA貢獻1807條經(jīng)驗 獲得超9個贊
順便說一句,在 php 7.2 中這也可以工作:
? ? <?php
? ? $row = 1;
? ? if (($handle = fopen("ad.csv", "r")) !== FALSE) {
? ? ? ? while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
? ? ? ? ? ? echo ($data[0].",".$data[1].",".$data[2].",".$data[3]."\n");
? ? ? ? }
? ? ? ? fclose($handle);
? ? }
? ? ?>
此外,.csv 數(shù)據(jù)上的引號應(yīng)包含所有數(shù)據(jù),例如:
"Isaac Newton","newton@ldap.forumsys.com",,"newton"
"Albert Einstein","einstein@ldap.forumsys.com","314-159-2653","einstein"
"Nikola Tesla","tesla@ldap.forumsys.com",,"tesla"
"Galileo Galilei","galieleo@ldap.forumsys.com",,"galieleo"
- 1 回答
- 0 關(guān)注
- 166 瀏覽
添加回答
舉報