我目前有一個腳本,它允許用戶查看目錄中的文件。我想知道如何讓這些文件可以下載。我認爲這與index.php有關,但不確定。以爲我最好只是檢查和澄清我的腳本如下。查看和下載目錄中的文件
<?php
$path = "/home/phpprac/assesment";
$dir_handle = @opendir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php")
continue;
echo "<a href=\"$file\">$file</a><br />";
}
// Close
closedir($dir_handle);
?>
你的文件不應該已經下載嗎? –
不幸的是,他們不是。不完全確定原因 – user1371500