[PHP] Cómo obtener datos de un CSV mediante PHP

Para esto, vamos a utilizar la función fgetcsv que leerá correctamente una sola fila de un archivo, moviendo el puntero a la siguiente fila en el proceso.

$row = 1;
if (($handle = fopen("NOMBRE.csv", "r")) !== FALSE) {
  while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $num = count($data);
    echo "<p> $num fields in line $row: <br /></p>\n";
    $row++;
    for ($c=0; $c < $num; $c++) {
        echo $data . "<br />\n";
    }
  }
  fclose($handle);
}

 

PandaGG
Lok'tar ogar

Dejar respuesta

Please enter your comment!
Please enter your name here

Sponsor

Últimos

Themenslots mit Ägypten Motiv

EinführungThemenslots mit Ägypten Motiv sind ein faszinierendes Segment der Online-Spielautomaten, das die reiche Kultur und Geschichte Ägyptens in den Mittelpunkt stellt. Diese Spielautomaten sind...

Yabby Casino Customer Support: How Players Can Get Help with Account and Payment Questions

IntroductionIn the world of online gaming, customer support plays a crucial role, especially for beginners navigating platforms like Yabby Casino. Understanding how to access...

Casino en ligne retrait express : Guide complet pour les parieurs expérimentés

IntroductionLe monde des jeux d'argent en ligne a évolué de manière significative ces dernières années, et le concept de retrait express est devenu un...

Royal Panda Casino Review for Canadian Players

IntroductionRoyal Panda Casino has emerged as a popular online gaming destination for players in Canada. With its user-friendly interface and a wide variety of...

Exploring the Different Gaming Categories Available on Roobet

IntroductionRoobet is an online gaming platform that has gained popularity among players in Canada. It offers a variety of gaming categories that cater to...