php foreach正序倒序输出示例代码

时间:2022-08-23 13:03:49

实现代码:

php" id="highlighter_595881">
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 正序
foreach($files as $file_num => $file) {
    if(is_file($directory.$file)){
        //$file = iconv("gb2312","UTF-8",$file); //或者 iconv("gb2312","UTF-8",$value);
        $date = substr($file,0,9);
        echo '<li class="world-cup-'.$date.'">';
        echo '<a href="'.$directory.$file.'" rel="worldcup" title="巴西世界杯赛事'.$date.'">';
        echo '<img src="'.$directory.$file.'" id="codetool">

延伸 · 阅读

精彩推荐