最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php递归遍历目录实现程序
时间:2012-11-20 编辑:简简单单 来源:一聚教程网
代码如下 | 复制代码 |
class listdir{ function listdir($dir){ //把结果保存进多维数组 //字符窜化结果 function tostring($dir=”"){
$this->tostring.=”Directory:”.$dir.”n”; while(false!==($item=$d->read())) { if($item!=”.”&&$item!=”..”) { $path=$dir.”/”.$item; if(is_dir($path)){ $this->depth+=1; $this->tostring($path); }else{ $this->tostring.=” } } } $this->depth-=1; $d->close(); $this->tostring.=” return $this->tostring; } } $wapdir=”jquery”; $d=new listdir($wapdir); echo $d->tostring(); ?> |
递归创建多级目录
1.先判断最底层目录div/css/layout是否存在;2.判断div/css/layout的上层目录div/css是否存在,不存在则以div/css作为参数递归进行
下面是程序代码:
代码如下 | 复制代码 |
function mkdirs($dir)
function rmdirs($dir) |
-
上一个: php简单的日历程序代码
-
下一个: php流程控制
相关文章
- php 目录递归遍历程序 10-15
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24