我不确定这有多简单,但我正在使用一个脚本来显示特定文件夹中的文件,但是我希望它们按字母顺序显示,这样做很难吗?这是我正在使用的代码:
if ($handle = opendir($mainframe->getCfg( 'absolute_path' ) ."/images/store/")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (($file != "index.html")&&($file != "index.php")&&($file != "Thumbs.db")) {
$strExt = end(explode(".", $file));
if ($strExt == 'jpg') {
$Link = 'index.php?option=com_shop&task=deleteFile&file[]='.$file;
$thelist .= '<tr class="row0"><td nowrap="nowrap"><a href="'.$Link.'">'.$file.'</a></td>'."\n";
$thelist .= '<td align="center" class="order"><a href="'.$Link.'" title="delete"><img src="/administrator/images/publish_x.png" width="16" height="16" alt="delete"></a></td></tr>'."\n";
}
}
}
}
closedir($handle);
}
echo $thelist;
:)