PHP - parsing a txt file

后端 未结 9 1814
余生分开走
余生分开走 2020-11-29 18:43

I have a .txt file that has the following details:

ID^NAME^DESCRIPTION^IMAGES
123^test^Some text goes here^image_1.jpg,image_2.jpg
133^hello^some other test^         


        
9条回答
  •  星月不相逢
    2020-11-29 19:30

    By far the best and simplest example of this I have come accross is quite simply the file() method.

    $array = file("myfile");
    foreach($array as $line)
           {
               echo $line;
           }
    

    This will display all the lines in the file, this is also applicable for a remote URL.

    Simple and clear.

    REF : IBM PHP Parse

提交回复
热议问题