Re: [請益] 請問有以 web 方式列出目錄檔案的程式嗎?
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章