Answer the question
In order to leave comments, you need to log in
How to display directory contents recursively in php?
help to configure the display of the contents of the directory
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Пример веб-страницы с php кодом</title>
</head>
<body>
<?
$dir = "/var/ftp/";
if($handle = opendir($dir)){
while(false !== ($file = readdir($handle))) {
if($file != "." && $file != ".."){
echo $file."<br>";
}
}
}
?>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
<?
function ftp_recursive($dir)
{
if($handle = opendir($dir)){
while(false !== ($file = readdir($handle))) {
if($file != "." && $file != ".."){
echo $file."<br>";
if(is_dir($dir."/".$file)) {ftp_recursive($dir."/".$file);}
}
}
}
}
?>
ftp_recursive("/var/ftp/");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question