I need to read a directory and change its icons. If it is a directory, apply an icon, if it is a .txt file, apply another icon.
Here is the code I did:
<?php
$dir = 'ftp/';
$pasta = opendir($dir);
while ($arquivo = readdir($pasta)){
// Caso o arquivo tenho '.' identificaria como .txt
if ($arquivo = '.' ){
echo "<img src='../img/pasta.ico'>";
} else {
echo "<img src='../img/archive.ico'>";
}
}
?>