Visualizzazione dei risultati da 1 a 4 su 4

Discussione: [PHP] file txt

  1. #1

    [PHP] file txt

    Ho un file di testo gradi.txt sì strutturato:

    codice:
    bla1|2|
    bla2|3|
    Come faccio a farli visualizzare separandoli, cioé assegnando a bla1 e bla2 uguali a $blas e 2 e 3 uguali a $numeri.

    dovrei visualizzare tutti i dati scrivendo:

    codice:
    echo $blas.$numeri;


    Grazie!
    GdR Online - http://lenar.it/
    Yesterday is history. Tomorrow is mystery.
    Today is a gift. That's why it's called the present

  2. #2
    Utente di HTML.it L'avatar di xPilux
    Registrato dal
    Jul 2004
    Messaggi
    103
    usando:
    Codice PHP:
    $lines file('nome del file'); 
    avrai un array composto dalle
    linee del tuo file!

    Su ogni linea poi usi la
    funzione split() o explode()
    per dividere la stringa in due usando il tuo separatore!

  3. #3
    Mi ero dimenticato di precisare (scusate) che non so il numero preciso di righe e che l'utente le può aggiungere e togliere a sua scelta...forse utilizzando sizeof() e qualche ciclo while...
    GdR Online - http://lenar.it/
    Yesterday is history. Tomorrow is mystery.
    Today is a gift. That's why it's called the present

  4. #4
    risolto
    GdR Online - http://lenar.it/
    Yesterday is history. Tomorrow is mystery.
    Today is a gift. That's why it's called the present

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.