in my php out put i get this data:
./dir.php 9e72b711c24294c992824fbe9014f815 124 ./echo.php 51324b9fc549f4b06148e4ff7674518e 239 ./New Text Document.txt d41d8cd98f00b204e9800998ecf8427e 0 ./update.php 90d1bd336fd6604a9bff164099349766 910
i want to remove "./" form the first of file names in output data.
what can i do?!
my php code:
Code: Select all
<?PHP
require_once "./dir.php";
require_once "./echo.php";
function getFileList($dir)
{
// array to hold return value
$retval = array();
// add trailing slash if missing
// if(substr($dir, -1) != "/") $dir .= "/";
// open pointer to directory and read list of files
$d = @dir($dir) or die("getFileList: Failed opening directory $dir for reading");
while(false !== ($entry = $d->read())) {
// skip hidden files
if($entry[0] == ".") continue;
if(is_dir("$dir$entry")) {
$retval[] = array(
"name" => "$dir$entry/",
"size" => 0,
"Stream" => md5_file("$dir$entry")
);
} elseif(is_readable("$dir$entry")) {
$retval[] = array(
"name" => "$dir$entry",
"size" => filesize("$dir$entry"),
"Stream" => md5_file("$dir$entry")
);
}
}
$d->close();
return $retval;
}
?>
and echo.php:
Code: Select all
<?PHP
// output file list as HTML table
foreach($dirlist as $file) {
echo "<tr>\n";
echo "<td>{$file['name']}</td>\n";
echo "<td>{$file['Stream']}</td>\n";
echo "<td>{$file['size']}</td>\n";
}
echo "\n";
?>
Code: Select all
<?PHP
// examples for scanning the current directory
$dirlist = getFileList(".");
$dirlist = getFileList("./");
?>