作者MyNameIs5566 (我是5566)
看板PHP
标题Re: [请益] 请问有以 web 方式列出目录档案的程式吗?
时间Mon Jul 7 19:26:49 2008
※ 引述《MyNameIs5566 (我是5566)》之铭言:
: 请问一下,
: 有没有这种懒人软体,
: http://autoindex.sourceforge.net/demo/
: 类似这样的功能,
: 能直接列印出 linux 主机下某个资料夹的档案,
: 并且支援中文 UTF-8 编码的中文档名,
: 最好是 PHP4 的,
: 不要动到MySQL的。
: 请问,
: 有这麽好的软体吗?
: ps:我写不出来啦.......板众不要叫我自己写啦~ ^^|||
自问自答一下:
<?
echo "<HTML><Meta Http-Equiv=Content-Type Content=text/html; Charset=UTF-8>";
//define the path as relative
$path = "./";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/><hr>";
//running the while loop
while ($file = readdir($dir_handle))
{
if($file!="list.php" && $file!=".list.php.swp" && $file!=".." &&
$file!=".")
{
echo "<a href=".$file.">";
echo "$file";
echo "</a><br>";
}
}
//closing the directory
closedir($dir_handle);
echo "</HTML>";
?>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.104.148.38