0
使用下面的代码,我正在生成位于服务器上的目录中的pdf列表。我希望按日期排序结果,最近的最早的最早的结果。按日期排序文件列表
这是在行动:http://mt-spacehosting.com/fisheries/plans/northeast-multispecies/
<?php
$sub = ($_GET['dir']);
$path = 'groundfish-meetings/';
$path = $path . "$sub";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
if (substr($file, -4, -3) =="."){
echo "$i. <option value='" . home_url('/groundfish-meetings/' . $file) . "'>$file</option>";
} $i++;
}
} closedir($dh);
?>
</select>
任何帮助,将不胜感激。
好吧,我得到了一个工作,但目录正在选项文本中列出。任何方式来删除? – mtuttle
是的。使用: echo“$ i。”; – Jithesh
我最终不得不编辑回声线来生成正确的链接url,但你让我在那里!回声“$我。<选项值='”。 home_url($ file)。“'>”。str_replace(dirname($ file)。'/','',$ file)。“”; – mtuttle