Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
$files = scandir($dir);
$br=count($files);
for($i=2; $i<=$br; $i++)
{
echo $files[$i]."<br>";
}
Warning: scandir() [function.scandir]: Directory name cannot be empty in C:\xampp\htdocs\test.php on line 2
-Директория
--Под-директория
---Файл
---Файл
--Под-директория
-Директория
$dir="ПЪТ/ИМЕ НА ДИРЕКТОРИЯ";
$files = scandir($dir);
$br=count($files);
for($i=2; $i<=$br; $i++)
{
echo $files[$i]."<br>";
}
<?php
//define the path as relative
$path = "C:\\xampp\\htdocs";
$webpath ="localhost";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/>";
list_dir($dir_handle,$path);
function list_dir($dir_handle,$path)
{
// print_r ($dir_handle);
echo "<ol>";
//running the while loop
while (false !== ($file = readdir($dir_handle))) {
$dir =$path.'\\'.$file;
if(is_dir($dir) && $file != '.' && $file !='..' )
{
$handle = @opendir($dir) or die("unable to open file $file");
echo "<li><a href='".$webpath . $file."'>$file</a></li>";
list_dir($handle, $dir);
}elseif($file != '.' && $file !='..')
{
echo "<li><a href='".$webpath . $file."'>$file</a></li>";
}
}
echo "</ol>";
//closing the directory
closedir($dir_handle);
}
?>
//define the path as relative
$path = "image/";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/>";
list_dir($dir_handle,$path);
function list_dir($dir_handle,$path)
{
// print_r ($dir_handle);
echo "<ol>";
//running the while loop
while (false !== ($file = readdir($dir_handle)))
{
$dir =$path.''.$file;
if(is_dir($dir) && $file != '.' && $file !='..' )
{
$handle = @opendir($dir) or die("unable to open file $file");
echo "<li><a href='".$path."/" . $file."'>$file</a></li>";
list_dir($handle, $dir);
}
elseif($file != '.' && $file !='..')
{
echo "<li><a href='".$path . $file."'>$file</a></li>";
}
}
echo "</ol>";
//closing the directory
closedir($dir_handle);
}
Directory Listing of C:\xampp\htdocs
1. admin.php
2. admin_list.php
3. ban_list.php
4. calendar.html
5. calendar1.js
6. COPYING
7. CREDITS
8. extras
9. functions.php
10. images
11. include
12. index.php
13. install
14. language
15. login.php
16. logout.php
17. motd.php
18. search.php
19. temp
20. templates
21. test.php
22. view.php
//define the path as relative
$path = "htdocs/";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/>";
list_dir($dir_handle,$path);
function list_dir($dir_handle,$path)
{
// print_r ($dir_handle);
echo "<ol>";
//running the while loop
while (false !== ($file = readdir($dir_handle)))
{
$dir =$path.''.$file;
if(is_dir($dir) && $file != '.' && $file !='..' )
{
$handle = @opendir($dir) or die("unable to open file $file");
echo "<li><a href='".$path."/" . $file."'>$file</a></li>";
list_dir($handle, $dir);
}
elseif($file != '.' && $file !='..')
{
echo "<li><a href='".$path . $file."'>$file</a></li>";
}
}
echo "</ol>";
//closing the directory
closedir($dir_handle);
}
//define the path as relative
$path = "image/";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/>";
list_dir($dir_handle,$path);
function list_dir($dir_handle,$path)
{
// print_r ($dir_handle);
echo "<ol>";
//running the while loop
while (false !== ($file = readdir($dir_handle)))
{
$dir =$path.''.$file;
if(is_dir($dir) && $file != '.' && $file !='..' && end(explode(".",$file))=="php" )
{
$handle = @opendir($dir) or die("unable to open file $file");
echo "<li><a href='".$path."/" . $file."'>$file</a></li>";
list_dir($handle, $dir);
}
elseif($file != '.' && $file !='..' && end(explode(".",$file))=="php")
{
echo "<li><a href='".$path . $file."'>$file</a></li>";
}
}
echo "</ol>";
//closing the directory
closedir($dir_handle);
}
Directory Listing of ../htdocs/
1. admin.php
2. admin_list.php
3. ban_list.php
4. functions.php
5. index.php
6. login.php
7. logout.php
8. motd.php
9. search.php
10. test.php
11. view.php