Pages

Folders in PHP

PHP also allows you to work with folders on the server. We will not go through all the different possibilities - only show an example. Again, see the documentation for more information.


Example :

 <html>
 <head>
 <title>FileSystemObject</title>
 </head>
 <body>

 <?php
   
 // Opens the folder
 $folder = opendir("../../tutorials/php/");

 // Loop trough all files in the folder
 while (($entry = readdir($folder)) != "") {
    echo $entry . "<br />";
 }

 // Close folder
 $folder = closedir($folder);

 ?>

 </body>

 </html>

No comments:

Flag Counter
| Copyright © 2013 Remote Tutor