Monday, March 21, 2016

Showing the files in a directory using PHP code

Showing the files in a directory using PHP code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

class FileLister {

  private $files;
  private $dir;

        public function index()
        {
         $this->dir = 'D:\\wamp\\www\\repo\\phpbackend\\application\\models';
         
        }

        public function listFiles(){
            $this->files = scandir($this->dir);

            var_dump($this->files);
            
            echo "<br /><br />";
        }
}

?>

No comments:

Post a Comment