超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<dio_writechdir>
Last updated: Fri, 22 Jun 2007

XXIV. 目录函数库

需求

无需外部库文件就可以加入本扩展模块的支持。

安装

这些函数作为 PHP 核心的一部分,无需被安装即可使用。

运行时配置

该扩展模块未定义任何设置指令。

预定义常量

由于这些常量是由该扩展模块定义的,因此只有在该扩展模块被编译到 PHP 中,或者在运行时被动态加载后,这些常量才有效。

DIRECTORY_SEPARATOR (string)

PATH_SEPARATOR (string)

参见

相关函数例如 dirname()is_dir()mkdir()rmdir(),见文件系统函数库一节。

目录
chdir -- 改变目录
chroot -- 改变根目录
dir -- directory 类
closedir -- 关闭目录句柄
getcwd -- 取得当前工作目录
opendir -- 打开目录句柄
readdir -- 从目录句柄中读取条目
rewinddir -- 倒回目录句柄
scandir --  列出指定路径中的文件和目录



add a note add a note User Contributed Notes
目录函数库
ben AT tech-space DOT net
24-May-2002 02:10
//lists all files in a directory with a given file name convention

function list_dir($file_name_convention) {
 switch ($file_name_convention) {
   case 'dated_reports':
     //matches files like '5_23_2002.html'
     $this_regexp = "/[0-9]{1,}_[0-9]{1,}_[0-9]{4,}/";
     break;
     //add more cases of file name conventions
 }
 $this_dir = dir('.');
if ($this_regexp != null) {
   while ($file = $this_dir->read()) {
     if (preg_match($this_regexp, $file)) {
      $result_array[] = $file;
     }
   }
 }
 return $result_array;
}

<dio_writechdir>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22