0

i save edit log in txt files, my problem is how to echo/show all available log/txt files in log directory

im already made function for read file

function readFile($filename) {
    $myfile = fopen("$filename", "r") or die("Unable to open file!");
    // Output one line until end-of-file
    while(!feof($myfile)) {
      echo fgets($myfile) . "<br>";
    }
    fclose($myfile);    
}

above code just function for readfile, my problem is show available files , thanks

Putra Fajar Hasanuddin
  • 1,101
  • 3
  • 13
  • 25

1 Answers1

2

You're looking at using opendir() or the DirectoryIterator class.

Similar question on Stack Overflow.

PHP script to loop through all of the files in a directory?

Should get you going in correct direction.

Community
  • 1
  • 1
Zander Rootman
  • 2,178
  • 2
  • 17
  • 29