|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-30 16:16 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Description: ------------ When you use "/." as parameter for scandir function, you list the content of your drive's root in place of you server's root. Reproduce code: --------------- <?php //List directories only function list_dirs($path) { $list = scandir($path); foreach ($list as $number => $filename) { if ( $filename !== '.' && $filename !== '..' && is_dir("$path/$filename") ) { // Asign more readable and logic variables $dir = $filename; $url = apache_request_headers(); { // Print Dirs with link print ("<a href=\"http://$url[Host]/$path/$dir\">/$path/$dir</a> <br>\n"); $newpath=$path . "/" . $dir; list_dirs($newpath); } } } } list_dirs('/.') ?> Expected result: ---------------- i would like to see the directories contained in the root of the server. Actual result: -------------- I see the directories contained in the root of the drive