« Posts tagged RSS

rss.php

还没搞清楚怎么用php操作xml,做Nerr Photos的时候用到rss就写了个傻了一点的,呵呵,丢人了

^————————–^

至少现在Nerr Photos可以用了,开心!开心就好!

PHP
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
27
28
29
30
31
32
33
34
35
36
37
<?php
//Leon Chong | 2009-2-4
//历遍目录
function outputDirFile($dir){
    if(is_dir($dir)){
        if($handle = opendir($dir)){
            while(false != ($file = readdir($handle))){
                if($file != "." &#038;& $file != ".."){
                    $child_dir = $dir."/".$file;
                    if(is_dir($child_dir)){
                        //echo "<h1>".$file."</-->";
                        //outputDirFile($child_dir);
                    }else{
                        $title = substr($file, 0, -4);
                        $result .=  'http://photo.nerrsoft.com'."\n";
                    }
                }
            }
            closedir($handle);
        }
    }
    return $result;
}
//RSS内容
$rs = '
http://nerrsoft.comNerr Photos';
$fileDir = './images';
$rs .= outputDirFile($fileDir);
$rs .= '';
//echo $rs;
//写入文件
@$bruce=fopen("photos.rss",'w');
if($bruce){
    //fwrite($bruce,$rs);
}
fclose($bruce);
?>