Why is the path for the folder not inserted into the link, and how to display the image of the folder, only for the folder?
Now I have images of the folder for all files except text and images.
Is it even possible to somehow check for a folder?
<?php error_reporting(-1); header('Content-Type: text/html; char set=utf-8'); ini_set('display_errors', 'On'); $img = 'papka.jpg'; $img2 = 'file.jpg'; $img3 = 'img.jpg'; $dir = 'C:\OpenServer\domains\localhost\kurs\16\dzfm'; $dir2 = 'localhost\kurs\16\dzfm'; $files = scandir($dir); echo '<ul style="padding: 0">'; foreach ($files as $f) { echo '<li style="list-style: none;">'; if(pathinfo($f, PATHINFO_EXTENSION) == 'txt'){ echo '<img src="' . $img2 . '">'; echo "<span style=' display: inline-block; vertical-align: top; padding-left: 3px;'>$f</span>"; } elseif(pathinfo($f, PATHINFO_EXTENSION) == 'jpg'){ echo '<img src="' . $img3 . '">'; echo "<span style=' display: inline-block; vertical-align: top; padding-left: 3px;'>$f</span>"; } else{ echo ""?><a href="<?php '"' . $dir2 . '\\' . $f . '"'?>"><?php echo ""; echo '<img src="' . $img . '">'; echo "<span style=' display: inline-block; vertical-align: top; padding-left: 3px;'>$f</span>"; echo '</a>'; } echo '</li>'; } echo '</ul>'; echo $dir2 . '\\' . $f; ?> <a href=<?php '"' . $dir2 . '\\' . $f . '"'?>>ссылка<a/> I replaced the else with such a check and for some reason also outputs everything, and not just the folders
elseif(!is_file($dir2 . '\\' . $f)){ this also does not work elseif
(is_dir($dir2 . '\\' . $f)){