Автор Тема: CSV (Ну ламер я, ламер!!!!!!)  (Прочитано 2341 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Guard

  • Фанат форума
  • Постоялец
  • ***
  • Сообщений: 147
  • +0/-0
  • 0
    • Просмотр профиля
    • http://www.rowing-don.narod.ru
CSV (Ну ламер я, ламер!!!!!!)
« : 29 Мая 2002, 16:14:14 »
Я много сдесь вопросов задавал по перегонке Экселевских доков в ПХП. Мне посоветовали CSV.

Я так понял это текстовый файл с разделителями..


Помогите мне теперь разобраться.

То есть, как ПХП работает с CSV.
Хоть ссылочку какую.

Плиз

Оффлайн Stek

  • Обожатель PHP
  • Ветеран
  • *****
  • Сообщений: 532
  • +0/-0
  • 2
    • Просмотр профиля
    • http://www.phpdevs.com
CSV (Ну ламер я, ламер!!!!!!)
« Ответ #1 : 29 Мая 2002, 16:50:13 »
А никак не работает, ручками все делать надо.
Единственное что есть это
Цитировать
fgetcsv -- Gets line from file pointer and parse for CSV fields
Description
array fgetcsv ( int fp, int length [, string delimiter])


Similar to fgets() except that fgetcsv() parses the line it reads for fields in CSV format and returns an array containing the fields read. The field delimiter is a comma, unless you specify another delimiter with the optional third parameter.

Fp must be a valid file pointer to a file successfully opened by fopen(), popen(), or fsockopen()

Length must be greater than the longest line to be found in the CSV file (allowing for trailing line-end characters).

fgetcsv() returns FALSE on error, including end of file.

N.B. A blank line in a CSV file will be returned as an array comprising a single NULL field, and will not be treated as an error.

Example 1. fgetcsv() example - Read and print entire contents of a CSV file

$row = 1;
$fp = fopen ("test.csv","r");
while ($data = fgetcsv ($fp, 1000, ",")) {
    $num = count ($data);
    print "

$num fields in line $row:
";
    $row++;
    for ($c=0; $c < $num; $c++) {
        print $data[$c] . "
";
    }
}
fclose ($fp);
 
 

PHP без башни - сделай свою жизнь разнообразнее.
Разбираю скрипты, собираю заново, вытираю пыль с баз данных.

Оффлайн AlieN

  • Абыр!=)
  • Ветеран
  • *****
  • Сообщений: 1315
  • +0/-1
  • 2
    • Просмотр профиля
CSV (Ну ламер я, ламер!!!!!!)
« Ответ #2 : 29 Мая 2002, 17:38:16 »
The Chemical Brothers - Hey Boy Hey Girl (User Friendly Mix)
Peter Presta pres - Set Sail(Peter Presta Apple Jaxx Dub) She S.Sunshine Feat Mila - Bring The Beat Back (Club Mix) Jerry Ropero - Home Alone (Dub Mix)

 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28