非常好的目录导航文件代码
这个代码虽然短小,但很实用,它可以轻松建立你指定的目录里的指定后缀名文件的超连接,而且可以设定,不会将指定的目录首页导航。
<?php
function navbar(){
$files = dir("."); //指定目录
$pipe = " | "; //管道符
//通过以下的循环搜索目录中所有文件
while ($current = $files->read()) {
//ignor all files not of htm type.
if (strpos($current, "php")!= FALSE) //设定后缀为PHP的文件将被导航
//忽略自己(如 index.html)
{ if (strpos($current, "ndex") == FALSE)
{
print "<a href='";
print $current;
print "'>";
print $current;
print "</a>";
print $pipe;
};
};
};
};
navbar() //调用函数
?>
相关推荐
-
非常好的目录导航文件代码
这个代码虽然短小,但很实用,它可以轻松建立你指定的目录里的指定后缀名文件的超连接,而且可以设定,不会将指定的目录首页导航. <?php function navbar(){ $files = dir("."); //指定目录 $pipe = " | "; //管道符 //通过以下的循环搜索目录中所有文件 while ($current = $files->read()) { //ignor all files not of htm type.
-
非常好的php目录导航文件代码
这个代码虽然短小,但很实用,它可以轻松建立你指定的目录里的指定后缀名文件的超连接,而且可以设定,不会将指定的目录首页导航. <?php function navbar(){ $files = dir("."); //指定目录 $pipe = " | "; //管道符 //通过以下的循环搜索目录中所有文件 while ($current = $files->read()) { //ignor all files not of htm type. if (s
-
基于python判断目录或者文件代码实例
这篇文章主要介绍了基于python判断目录或者文件代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 1. 判断目录是否存在 'isdir',删除目录时只有该目录为空才可以 'rmdir' import os if(os.path.isdir('D:/Python_workspace/spyder_space/test_各种功能/哈哈哈哈')): #判断目录是否存在 print('yes') os.rmdir('D:/Python_work
-
java怎么创建目录(删除/修改/复制目录及文件)代码实例
复制代码 代码如下: import java.io.*; public class FileOperate { public FileOperate() { } /** * 新建目录 * @param folderPath String 如 c:/fqf * @return boolean */ public void newFolder(String folderPath) { try { String filePath = folder
-
删除无限级目录与文件代码共享
<?//删除目录//本程序由wm_chief原创,如要转载,请注明作者与来源(http://www.phome.net)class del_path{function wm_chief_delpath($del_path){if(!file_exists($del_path))//目标目录不存在则建立{echo"目录不存在";return false;}$hand=opendir($del_path);$i=0;while($file=readdir($hand)){$i+
-
php 删除无限级目录与文件代码共享
<? //删除目录 class del_path { function wm_chief_delpath($del_path) { if(!file_exists($del_path))//目标目录不存在则建立 {echo"目录不存在";return false;} $hand=opendir($del_path); $i=0; while($file=readdir($hand)) {$i ; if($i==1||$i==2) {continue;} if(!(strchr($
-
批量转换目录下文件编码的shell脚本代码
一例批量转换目录下文件编码的shell脚本代码. 需求描述:由于从window转linux过来,很多原来win下的gbk文件需要转换成utf8. 以下脚本仅判断非utf8文件转换成utf8文件,并且默认非utf8文件为gbk,如果文件类型不一致需要修改. 例子: 复制代码 代码如下: #!/bin/bash# File Name: iconv.sh# Author: wanggy# site: www.jb51.net#show_file(){ for file in `ls $1`
-
dos下遍历目录和文件的代码(主要利用for命令)
===== 文件夹结构 ============================================= D:\test ---A Folder 1 |-----A file 1.txt |-----A file 2.txt |-----A file 3.txt ---B Folder 2 |-----B file 1.txt |-----B file 2.txt |-----B file 3.txt |---B Folder 3 |-----B sub
-
代码实例Java IO判断目录和文件是否存在
我们先来看完整的代码: import java.io.File; public class JudgeFile { public static void main(String[] args) { File dir = new File("D:/"); //声明D磁盘 File file = new File(dir,"test"); //声明D磁盘根目录下名为test的文件 boolean d=dir.exists(); boolean f=file.exists
-
易语言调用API函数监视目录与文件的代码
DLL命令表 .版本 2 .DLL命令 GetPrivateProfileInt, 整数型, , "GetPrivateProfileIntA" .参数 lpAppName, 文本型 .参数 lpKeyName, 文本型 .参数 nDefault, 整数型 .参数 lpFileName, 文本型 .DLL命令 GetPrivateProfileString, 整数型, , "GetPrivateProfileStringA" .参数 lpAppName, 文本型 .
随机推荐
- Seraph 4.0版本以后的新的脚本示例
- XML CDATA的作用
- Mac OS上安装PostgreSQL的教程
- jQuery实现简单的网页换肤效果示例
- ajax的json传值方式在jsp页面中的应用
- vb.net发布水晶报表程序步骤
- oracle 触发器 学习笔记
- aspx中页面按钮写返回上一页代码
- JavaScript中使用Callback控制流程介绍
- 从请求管道深入剖析HttpModule的实现机制图文介绍
- PHP+AjaxForm异步带进度条上传文件实例代码
- php入门教程之Zend Studio设置与开发实例
- 基于逻辑运算的简单权限系统(实现) JS 版
- mysql事件的开启和调用
- Centos7.3下vsftp服务的安装方法
- CentOS 6.5配置本地Yum源教程
- JQuery animate动画应用示例
- python3用PIL把图片转换为RGB图片的实例
- python爬虫 基于requests模块发起ajax的get请求实现解析
- Python二进制串转换为通用字符串的方法