0
屏幕上顯示的PDF文檔按時間順序排列。他們已經上傳到Wordpress中的FILEMANAGER模塊。我們需要將從1到12到12 - 1的順序顛倒過來,排在最前面,最下面的是1。如何反轉屏幕上顯示文檔的順序
echo '<form name="myform" action="http://...." method="POST">';
$dirPath = dir('./wp-content/uploads/...');
$imgArray = array();
while (($file = $dirPath->read()) !== false)
{
if ((substr($file, -3)=="pdf") || (substr($file, -3)=="xls") || (substr($file, -3)=="png"))
{
$imgArray[ ] = trim($file);
}
}
$dirPath->close();
sort($imgArray);
$c = count($imgArray);
for($i=0; $i<$c; $i++)
{
echo "<p class=\"downloads\">".ereg_replace('[^A-Za-z0-9]', ' ', getFilenameWithoutExt($imgArray[$i])) ."
<span class='complete'><a href=\"".get_home_url()."/wp-content/uploads/...".$imgArray[$i]."\" target=\"_blank\">
[view]</a></span> <input name=\"group1[]\" type=\"checkbox\" value=\"" . $imgArray[$i] . "\" /></p>";
}
echo '<input type="hidden" name="path" id="path" value="/wp-content/uploads/..." />
<input class="download" type="submit" value=" _ ">';
的工作原理,但我們現在有一個額外的複選框頂部文件 – user3252828
當設置複選框時,頁面將重新加載?如果是這樣,請使用@ Sankalp的答案並檢查是否相應地設置了排序。 – andy