RE: [PHP] Directory Listing Problem

From: Date: Tue, 03 Oct 2000 22:48:53 +0000
Subject: RE: [PHP] Directory Listing Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18485@lists.php.net to get a copy of this message
Hi, Thanks to everyone for all their advice. It's still not reading the files in the directory. I put in the code that Lawrence sent through. I added a printf statement in the GetDir function to just print out the path (shown in the code below). This is all the output I get when I call it like this: readdir.php?dir=/usr/local/apache/htdocs/intranet/quality ************************** Path = /usr/local/apache/htdocs/intranet/quality Current Working Directory: /usr/local/apache/htdocs/readdir.php ************************** This should be such a simple thing. Anyone know if this is a problem in PHP 4.0.3 dev? I might revert back to a different release of PHP4. > <?php > > function GetDir ($sPath) > { > printf("<BR>Path = %s<BR>", $sPath); > $handle=opendir ($sPath); > while ($file=readdir($handle)){ > echo $file . "<br>"; > } > } > > if (!isset($dir)) { > $dir="/tmp"; > } > > GetDir ($dir); > > print "<br>Current Working Directory: " . $SCRIPT_FILENAME; > > ?> Thanks, Sam

« previous php.general (#18485) next »