File.txt
Type | directory | file | size | creation time
file| C:\Program files\java\jre7\lib\zi\america\indiana| VEVAY|724|2014-10-13 09:36 file| C:\Program files\java\jre7\lib\zi\america\indiana| VINCENNES|884|2014-10-13 09:36file| C:\Program files\java\jre7\lib\zi\america\indiana| WINAMAC|932|2014-10-13 09:36 directory| C:\Program files\java\jre7\lib\zi\america| INDIANA|0|2014-10-13 09:36
readfile.php
<?php$f= fopen ("file.txt", "R"), while (!feof ($f)) { $line = fgets ($f); echo $line, "<br/>"; $str = Explode ("|", $line);//print_r ($STR); $file _type = $str [0]; $dir _name = $str [1] ; $file _name = $str [2]; $file _size = $str [3]; $create _time = $str [4];echo $file _type;echo "</br>"; echo $dir _name;echo "</br>", Echo $file _name;echo "</br>"; Echo $file _size;echo "</br>"; Echo $create _ Time;echo "</br>";} Fclose ($f);? >
Results show
PHP fgets read string and explode split string array by row