按字母顺序排序输出 [英] Sort the output alphabetically

查看:98
本文介绍了按字母顺序排序输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我如何更改/编辑我的代码,输出按

文件名(从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 ''&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>";

}
}
?>

Thanks!

推荐答案

nr = 0;

nr= 0;


handle = opendir(
handle=opendir (


path);


while(
path);

while(


这篇关于按字母顺序排序输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆