How to use PHP & Scandir() List Directory Learn how to use the PHP to List Directory and using Scandir()
ShotDev Focus:
- PHP & List Directory by Scandir()
Example
php_scandir.php
- <html>
- <head>
- <title>ShotDev.Com Tutorial</title>
- </head>
- <body>
- <?php
- $objScan = scandir("shotdev");
- foreach ($objScan as $value) {
- echo "folder : $value<br>";
- }
- ?>
- </body>
- </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_scandir.php
Screenshot