按字母顺序排序输出 [英] Sort the output alphabetically
问题描述
我如何更改/编辑我的代码,输出按
文件名(从az)排序?
<?php
$ nr = 0;
$ handle = opendir($ path);
while($ datei = readdir($ handle)){
if(preg_match(''/ ^ w + .htm $ /'',$ datei) ){$ / $
$ filearray = file(" $ datei");
$ filestring = implode("",$ filearray);
echo"< tr>" ;;
echo"< td class = \" text \" width = \" 4%\">"。++ $ nr。"< / td>" ;;
echo"< td class = \ " text\" width = \" 32%\">
< a class = \" link \" href = \" $ datei \"
target = \" _blank \"> $ datei< / a>< / td>" ;;
echo"< td class = \" verantw \" width = \" 32%\">" ;;
if(eregi(&!!!(。*)!!!!",$ filestring,$ verantwortlicher))echo
$ verantwortlicher [1];
else echo''& nbsp;'';
echo"< / td>" ;;
echo"< td class = \" text \" width = \" 32%\">" ;;
if(eregi("< title>(。*)< / title>",$ filestring, $ titel))echo
$ titel [1];
else echo''& nbsp;'';
echo"< ; / td>" ;;
echo"< / tr>" ;;
}
}
?>
谢谢!
Hi,
how do I have to change/edit my code that the output is sort by the
file name (from a-z)?
<?php
$nr= 0;
$handle=opendir ($path);
while($datei = readdir($handle)) {
if (preg_match(''/^w+.htm$/'', $datei)) {
$filearray = file("$datei");
$filestring = implode("",$filearray);
echo "<tr>";
echo "<td class=\"text\" width=\"4%\">".++$nr."</td>";
echo "<td class=\"text\" width=\"32%\">
<a class=\"link\" href=\"$datei\"
target=\"_blank\">$datei</a></td>";
echo "<td class=\"verantw\" width=\"32%\">";
if (eregi ("!!!!(.*)!!!!", $filestring, $verantwortlicher)) echo
$verantwortlicher[1];
else echo '' '';
echo "</td>";
echo "<td class=\"text\" width=\"32%\">";
if (eregi ("<title>(.*)</title>", $filestring, $titel)) echo
$titel[1];
else echo '' '';
echo "</td>";
echo "</tr>";
}
}
?>
Thanks!
推荐答案
nr = 0;
nr= 0;
handle = opendir(
handle=opendir (
path);
while(
path);
while(
这篇关于按字母顺序排序输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!