Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17757664
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-04-17 16:28:18

非常好的目录导航文件代码

这个代码虽然短小,但很实用,它可以轻松建立你指定的目录里的指定后缀名文件的超连接,而且可以设定,不会将指定的目录首页导航。

function navbar()

{
$files = dir("."); //指定目录
$pipe  = " | ";    //管道符
//通过以下的循环搜索目录中所有文件
while ($current = $files->read())

   {
     //ignor all files not of htm type.
    if (strpos($current, "\")!= FALSE)  //设定后缀为PHP的文件将被导航
       //忽略自己(如 index.html)
       {   

          if (strpos($current, "ndex") == FALSE)
          {
             print "";
             print $current;
             print "
";
             print $pipe;
          };  
       }; 
     }; 
};
navbar() //调用函数
?>

阅读(291) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~