php simple browse directory content implementation code
- 2020-06-07 04:08:13
- OfStack
As shown below:
<?php
$dir = dirname(__FILE__);
$open_dir = opendir($dir);
echo "<table border=1 borderColor=red cellpadding=6>";
echo "<tr><th> The file name </th><th> The size of the </th><th> type </th><th> Modification date </th></tr>";
while ($file = readdir($open_dir)) {
if ($file!= "." && $file != "..") {
echo "<tr><td>" . $file . "</td>";
echo "<td>" . filesize($file) . "</td>";
echo "<td>" . filetype($file) . "</td>";
echo "<td>" . filemtime($file) . "</td></tr>";
}
}
echo "</table>";
?>